Skip to content

Commit f785a96

Browse files
committed
一个坑
1 parent 3639f27 commit f785a96

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Coding_iOS/AppDelegate.m

+10-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ - (void)registerPush{
6060
UIUserNotificationSettings *userSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert
6161
categories:[NSSet setWithObject:categorys]];
6262
[[UIApplication sharedApplication] registerUserNotificationSettings:userSettings];
63-
[[UIApplication sharedApplication] registerForRemoteNotifications];
6463
#endif
6564
}
6665
}
@@ -157,7 +156,7 @@ - (void)completionStartAnimationWithOptions:(NSDictionary *)launchOptions{
157156
@weakify(self);
158157
void (^successCallback)(void) = ^(void){
159158
//如果变成需要注册状态
160-
if(![XGPush isUnRegisterStatus] && [Login isLogin]){
159+
if([XGPush isUnRegisterStatus] && [Login isLogin]){
161160
@strongify(self);
162161
[self registerPush];
163162
}
@@ -227,6 +226,15 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(N
227226
[BaseViewController handleNotificationInfo:userInfo applicationState:[application applicationState]];
228227
}
229228

229+
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{
230+
DebugLog(@"%@", error);
231+
}
232+
233+
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{
234+
DebugLog(@"%@", notificationSettings);
235+
[application registerForRemoteNotifications];
236+
}
237+
230238
#pragma mark - Methods Private
231239
- (void)setupLoginViewController{
232240
LoginViewController *loginVC = [[LoginViewController alloc] init];

0 commit comments

Comments
 (0)