Ios 如果我使用任何xcode 6版本生成的ipa进行测试,则未收到AWS SNS通知,如何解决该问题?
我在ios中编写了代码来接收从“AWS SNS”发送的通知,如果我将设备直接连接到xcode并运行,则会收到通知;如果我从xcode版本低于6或通过iTunes生成ipa,则会收到通知。如果我从任何xcode 6版本生成ipa,则不会收到通知,如何修复此问题?我正在使用启用推送通知服务的开发配置文件和开发证书 didFinishLaunchWithOptions代码Ios 如果我使用任何xcode 6版本生成的ipa进行测试,则未收到AWS SNS通知,如何解决该问题?,ios,objective-c,amazon-web-services,Ios,Objective C,Amazon Web Services,我在ios中编写了代码来接收从“AWS SNS”发送的通知,如果我将设备直接连接到xcode并运行,则会收到通知;如果我从xcode版本低于6或通过iTunes生成ipa,则会收到通知。如果我从任何xcode 6版本生成ipa,则不会收到通知,如何修复此问题?我正在使用启用推送通知服务的开发配置文件和开发证书 didFinishLaunchWithOptions代码 if ([application respondsToSelector:@selector(registerUserNotific
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge
|UIRemoteNotificationTypeSound
|UIRemoteNotificationTypeAlert) categories:nil];
[application registerUserNotificationSettings:settings];
} else {
UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
[application registerForRemoteNotificationTypes:myTypes];
}
#ifdef __IPHONE_8_0
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
//register to receive notifications
[application registerForRemoteNotifications];
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler
{
[self showAlertIfNotificationReceives: userInfo];
//handle the actions
if ([identifier isEqualToString:@"declineAction"]){
}
else if ([identifier isEqualToString:@"answerAction"]){
}
}
#endif
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken{
NSLog(@"deviceToken: %@", deviceToken);
// Register with AWS SNS
}
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error{
NSLog(@"Failed to register with error : %@", error);
}
//Handle Notification if App is Open
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
NSLog(@"SNS Notification userInfo: %@",userInfo);
}
我正在接收设备令牌并成功注册AWS SNS,但我没有收到仅使用xcode 6版本ipa的通知。提前感谢您的帮助。XCode 6.4版自动获取“分发证书”以生成ipa,即使选择了“开发证书和开发配置文件”(我不知道为什么) 问题是:应用程序在生产APN中注册,因为xcode自动选择用于ipa生成的分发证书,AWS SNS APN沙盒服务器正在尝试向生产APN服务器设备令牌发送通知
最后,为发送通知而创建的AWS SNS生产应用程序r在后台模式或前台模式下在APNS中测试的u通知将在后台和前台模式下处理,我已经测试过,工作正常,除了xcode 6版本IPAS,APNS不是问题,显示您的didFinishLaunchingWithOptions代码声明的UIUserNotificationTypeI我已显示didFinishLaunchingWithOptions代码我的兄弟,如果我们需要检查代码,k祝您愉快,我删除我的答案