推送的实现

This commit is contained in:
fengshuo
2021-12-08 16:43:26 +08:00
parent 32bf79a4b3
commit 30d8a204fe
4 changed files with 19 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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>