一直被困在這個上,但無法獲得以下方法被調用。我可以讓手機申請許可,但之後就卡住了。不被調用的方法: - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken :(NSData *)deviceToken
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
NSLog(@"My token is: %@", deviceToken);
}
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
NSLog(@"Failed to get token, error: %@", error);
}
我已經嘗試了不少事情,包括:
1)在下面的計算器後提供的一切:why didRegisterForRemoteNotificationsWithDeviceToken is not called
2)從蘋果看這個技術說明:https://developer.apple.com/library/ios/technotes/tn2265/_index.html
3)這整個教程:http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1(希望我的證書都很好)
4)(是的,我有互聯網連接)
有沒有人有任何可能的解決方案?在過去的2-3天裏我一直在大聲疾呼,並且已經出廠重置了我的手機兩次,以及在手機上更改了日期N ^次,以便讓通知彈出窗口顯示一遍又一遍的測試。
想得到任何幫助!謝謝!
這裏是我使用的是什麼叫......(嘗試了一些其他的版本):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//other stuff not related
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
#ifdef __IPHONE_8_0
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert) categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];
#endif
} else {
UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
[application registerForRemoteNotificationTypes:myTypes];
}
return YES;
}
是iOS8嗎?還確實被叫做註冊表? – vichevstefan 2015-03-31 22:02:26
都不叫,iOS8 – John 2015-04-01 00:42:42
APNS證書安裝在生成機器上,還更新了配置文件? – gagarwal 2015-04-01 05:11:47