Привет я хочу реализовать GCM в прошивкой и у меня есть мой SenderID но я не знаю, где я должен реализовать SenderId .Это весь мой код для GCM integration.i нужно лексема value.so, пожалуйста, помогите мне сделать это.Google Cloud Messaging в прошивкой
AppDelegate:
#import "AppDelegate.h"
@interface AppDelegate()
{
NSDictionary *RegistrationOptions;
NSString *GcmSenderID;
GGLInstanceIDTokenHandler registrationHandler;
}
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
UIUserNotificationType allNotificationTypes=(UIUserNotificationTypeSound|UIUserNotificationTypeBadge);
UIUserNotificationSettings *settings=[UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];
[[UIApplication sharedApplication]registerUserNotificationSettings:settings];
[[UIApplication sharedApplication]registerForRemoteNotifications];
return YES;
}
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
// Create a config and set a delegate that implements the GGLInstaceIDDelegate protocol.
GGLInstanceIDConfig *instanceIDConfig = [GGLInstanceIDConfig defaultConfig];
instanceIDConfig.delegate = self;
// Start the GGLInstanceID shared instance with the that config and request a registration
// token to enable reception of notifications
[[GGLInstanceID sharedInstance] startWithConfig:instanceIDConfig];
RegistrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};
[[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:GcmSenderID
scope:kGGLInstanceIDScopeGCM
options:RegistrationOptions
handler:registrationHandler];
}
- (void)onTokenRefresh {
// A rotation of the registration tokens is happening, so the app needs to request a new token.
NSLog(@"The GCM registration token needs to be changed.");
[[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:GcmSenderID
scope:kGGLInstanceIDScopeGCM
options:RegistrationOptions
handler:registrationHandler];
}
, пожалуйста, дайте мне знать ответ – Arun