mKa*_*ane 5 objective-c ios firebase firebase-cloud-messaging
使用方法
[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]
我不太确定参数的要求是什么?什么是授权实体和行动?我也将苹果的APNS令牌传递给该方法吗?
例:
if (![[FIRInstanceID instanceID] token]) {
[[FIRInstanceID instanceID] tokenWithAuthorizedEntity:_gcmSenderId scope:kFIRInstanceIDScopeFirebaseMessaging options:_registrationOptions handler:^(NSString * _Nullable token, NSError * _Nullable error) {
// Fetch the token or error
}];
}
Run Code Online (Sandbox Code Playgroud)
你可以这样做。
[[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeProd];
[[FIRInstanceID instanceID] tokenWithAuthorizedEntity:gcmSenderID scope:kFIRInstanceIDTokenRefreshNotification options:nil handler:^(NSString * _Nullable token, NSError * _Nullable error) {
NSLog(@"GCM Registration token = %@",token);
NSLog(@"GCM Registration error = %@",error);
}];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4781 次 |
最近记录: |