Push Notification is not working?

我的梦境 提交于 2019-12-19 09:23:35

问题


i edit and modify the provisioning profile alot of times. and i checked it in text editor too. everything is ok with provisioning profile. but still push notifications are not working. and i m getting this error. everyone is saying that its bcz of bad provisioning profile but my provisioning profile values are the same as Apple said in their documentation. i m getting this error:

Error in registration. Error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x127d80 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

code lookes like this in my AppDelegate.m:

    - (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions {
                  [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |                       UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
                  [self.window addSubview:navigationController.view];
                  [self.window makeKeyAndVisible];
                  return YES;
       }
    -(void)application:(UIApplication )application didRegisterForRemoteNotificationsWithDeviceToken:(NSData )deviceToken {
                 NSString *deviceTokenStr = [[[[deviceToken description] stringByReplacingOccurrencesOfString: @"<" withString: @""] stringByReplacingOccurrencesOfString: @">" withString: @""] stringByReplacingOccurrencesOfString: @" " withString: @""];
                 NSLog(@"DeviceTokenStr: %@",deviceTokenStr);
       }

Thanx for help in advance


回答1:


I believe the "no valid 'aps-environment' entitlement string found for application" error appears when you don't sign your app with the correct provisioning profile. You'll have to generate a profile for your app as described in Mahesh's link). Also note that you can't use a team provisioning profile to sign an app that requires push notifications.



来源:https://stackoverflow.com/questions/5027880/push-notification-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!