2016-10-13 12 views
0

私のアプリのアップデート後に問題が発生しています。このフォーマットのデバイストークンを取得しています C43461D5-E9CB-4C10-81F8-020327A07A62 通知が機能していません。Apple通知デバイストークンの変更

私はこの形式で通知する前に: 2add70865401171c7ca1d3b3957b719eaf721fef8f8d7a52bc91ef8a872cc004

を私はアプリの通知を許可しなかったし、バックエンドで何も変更していません。 は、それが動作しない理由のいずれかのガイドを行うことができます。デバイストークンを取得didFinishLaunchingWithOptions

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) 
{ 
    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; 
    [[UIApplication sharedApplication] registerForRemoteNotifications]; 
} 
else 
{ 
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes: 
    (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)]; 
} 

コードは:

Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo={NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}, no valid 'aps-environment' entitlement string found for application

+0

あなたdidfinishlaunchのurコードを表示することができます –

+0

また、デバイストークンを取得するコードを表示します。 – ashmi123

+0

「IF([[[UIDevice currentDevice] systemVersion]に従ってFloatValue]> = 8.0) { [[のUIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettingsのsettingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)カテゴリ:なし]; [のUIApplication sharedApplication ] registerForRemoteNotifications];他の } { [[のUIApplication sharedApplication] registerForRemoteNotificationTypes: (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)]; は}」 –

答えて

0

クリック願っています - >プッシュ通知を有効にする

enter image description here

+0

ありがとうございました。 –

+0

@Jackこれは単にプッシュ通知のバックグラウンドモードに使用されます。それはなぜプッシュノフィが来ないのかとは関係ありません。要するに**これは** ** **プッシュノーティフを有効にするのに使用されていません。これはバックグラウンドモードで通知を処理するために使用されます。 –

+0

@RajanMaheshwariこのansはエラーgetに関連しています。だから、私はちょうどそのエラーのために "アプリケーションのための有効な 'aps - 環境'資格文字列が見つかりません"を与える。 – ashmi123

0
NSString *tempApplicationUUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; 

UUIDStringは、一意のデバイスIDがあるが、ために:

NSString *deviceTokenID = [[NSUserDefaults standardUserDefaults] objectForKey:DEVICE_TOKEN_PUSH_NOTI]; 
if ([deviceTokenID isEqualToString:@""] || deviceTokenID == nil) { 
    NSString *tempApplicationUUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; 
    [dics setObject:tempApplicationUUID forKey:@"cust_device_id"]; 
} else { 
    [dics setObject:[[NSUserDefaults standardUserDefaults] objectForKey:DEVICE_TOKEN_PUSH_NOTI] forKey:@"cust_device_id"]; 
} 

は、私はエラーの下になりましたApple Push NoあなたはデバイストークンがAPNSから戻ってくる必要があります。そのためには、以下のメソッドを使用して64桁のdeviceTokenを取得し、通知を取得します。

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken 


{ 
    NSString *devToken = [[[[deviceToken description] 
          stringByReplacingOccurrencesOfString:@"<"withString:@""] 
          stringByReplacingOccurrencesOfString:@">" withString:@""] 
          stringByReplacingOccurrencesOfString: @" " withString: @""]; 


    NSString *str = [NSString 
        stringWithFormat:@"Device Token=%@",devToken]; 

    [[NSUserDefaults standardUserDefaults]setObject:devToken forKey:@"DeviceToken"]; 

} 
2

enter image description here

plzは.xcodeprojに

クリックしに行く - >機能 - >機能 - >プッシュ通知を有効に

は、それが.xcodeprojに仕事

+0

ありがとうございました。 –

+0

@NaushadQamarようこそ。 –