差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 后一修订版 两侧同时换到之后的修订记录 | ||
im:ios:apns:offline [2020/01/02 08:39] huanxinfudh [设置 APNs 全局属性] |
im:ios:apns:offline [2020/01/02 08:42] huanxinfudh [全局免打扰设置] |
||
---|---|---|---|
行 81: | 行 81: | ||
* @param aCompletionBlock 完成的回调 | * @param aCompletionBlock 完成的回调 | ||
*/ | */ | ||
+ | - (void)getPushNotificationOptionsFromServerWithCompletion:(void (^)(EMPushOptions *aOptions, EMError *aError))aCompletionBlock; | ||
+ | |||
+ | // 调用: | ||
[[EMClient sharedClient] getPushNotificationOptionsFromServerWithCompletion:^(EMPushOptions *aOptions, EMError *aError) { | [[EMClient sharedClient] getPushNotificationOptionsFromServerWithCompletion:^(EMPushOptions *aOptions, EMError *aError) { | ||
if(!aError){ | if(!aError){ | ||
行 132: | 行 135: | ||
options.displayStyle = EMPushDisplayStyleMessageSummary // 显示消息内容 | options.displayStyle = EMPushDisplayStyleMessageSummary // 显示消息内容 | ||
// options.displayStyle = EMPushDisplayStyleSimpleBanner // 显示“您有一条新消息” | // options.displayStyle = EMPushDisplayStyleSimpleBanner // 显示“您有一条新消息” | ||
- | EMError *error = [[EMClient sharedClient] updatePushOptionsToServer]; // 更新配置到服务器,该方法为同步方法,如果需要,请放到单独线程 | + | [[EMClient sharedClient] updatePushNotificationOptionsToServerWithCompletion:^(EMError *aError) { |
- | if(!error) { | + | if(!aError){ |
- | // 成功 | + | NSLog(@"更新推送设置到服务器成功"); |
- | }else { | + | } else { |
- | // 失败 | + | NSLog(@"更新推送设置到服务器失败的原因 --- %@", aError.errorDescription); |
- | } | + | } |
+ | }]; | ||
</code> | </code> | ||
行 251: | 行 254: | ||
options.noDisturbingStartH = 0; | options.noDisturbingStartH = 0; | ||
options.noDisturbingEndH = 24; | options.noDisturbingEndH = 24; | ||
- | EMError *error = [[EMClient sharedClient] updatePushOptionsToServer]; | + | [[EMClient sharedClient] updatePushNotificationOptionsToServerWithCompletion:^(EMError *aError) { |
+ | if(!aError){ | ||
+ | NSLog(@"更新推送设置到服务器成功"); | ||
+ | } else { | ||
+ | NSLog(@"更新推送设置到服务器失败的原因 --- %@", aError.errorDescription); | ||
+ | } | ||
+ | }]; | ||
行 259: | 行 268: | ||
options.noDisturbingStartH = 9; | options.noDisturbingStartH = 9; | ||
options.noDisturbingEndH = 22; | options.noDisturbingEndH = 22; | ||
- | EMError *error = [[EMClient sharedClient] updatePushOptionsToServer]; | + | [[EMClient sharedClient] updatePushNotificationOptionsToServerWithCompletion:^(EMError *aError) { |
+ | if(!aError){ | ||
+ | NSLog(@"更新推送设置到服务器成功"); | ||
+ | } else { | ||
+ | NSLog(@"更新推送设置到服务器失败的原因 --- %@", aError.errorDescription); | ||
+ | } | ||
+ | }]; | ||
</code> | </code> | ||