iOS添加手机号设置接口

This commit is contained in:
JoshLi
2021-07-28 10:58:19 +08:00
parent fad4745e01
commit bc9e441fe2
2 changed files with 26 additions and 0 deletions
+23
View File
@@ -510,6 +510,29 @@
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObject:category]];
}
#pragma mark - 设置手机号
-(void)setMobileNumber:(CDVInvokedUrlCommand *)command {
NSDictionary* params = [command.arguments objectAtIndex:0];
NSNumber* sequence = params[@"sequence"];
NSString* number = params[@"mobileNumber"];
[JPUSHService setMobileNumber:number completion:^(NSError *error) {
NSMutableDictionary* dic = [[NSMutableDictionary alloc] init];
[dic setObject:sequence forKey:@"sequence"];
CDVPluginResult* result;
if (error) {
[dic setValue:[NSNumber numberWithUnsignedInteger:error.code] forKey:@"code"];
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic];
}
else {
// success
[dic setObject:number forKey:@"mobileNumber"];
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic];
}
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}];
}
#pragma mark - 内部方法
+(void)setupJPushSDK:(NSDictionary*)userInfo{