推送的实现
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#import <ShareSDK/ShareSDK.h>
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <UMCommon/UMCommon.h>
|
||||
#import <UserNotifications/UNUserNotificationCenter.h>
|
||||
///Tool
|
||||
#import "XPConstant.h"
|
||||
#import "CustomAttachmentDecoder.h"
|
||||
@@ -50,6 +51,13 @@ UIKIT_EXTERN NSString * kYinyouPrivateKey;
|
||||
[NIMSDKConfig sharedConfig].enabledHttpsForInfo = NO;
|
||||
[NIMSDKConfig sharedConfig].enabledHttpsForMessage = NO;
|
||||
#endif
|
||||
|
||||
if (@available(iOS 11.0, *)){
|
||||
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
|
||||
[center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) {
|
||||
}];
|
||||
}
|
||||
[[UIApplication sharedApplication] registerForRemoteNotifications];
|
||||
}
|
||||
|
||||
#pragma mark - 友盟SDK
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#import "FlutterBoost+Xplan.h"
|
||||
#import "AppDelegate+ThirdConfig.h"
|
||||
#import <AppTrackingTransparency/AppTrackingTransparency.h>
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
|
||||
@interface AppDelegate ()
|
||||
|
||||
@@ -60,4 +61,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
||||
// 上传devicetoken至云信服务器。
|
||||
[[NIMSDK sharedSDK] updateApnsToken:deviceToken];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -2,6 +2,8 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.applesignin</key>
|
||||
<array>
|
||||
<string>Default</string>
|
||||
|
@@ -2,6 +2,8 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.applesignin</key>
|
||||
<array>
|
||||
<string>Default</string>
|
||||
|
Reference in New Issue
Block a user