Я пытаюсь реализовать гибридное приложение, используя salesforcehybrid, пожалуйста, обратитесь по ссылке ниже
https://www.npmjs.com/package/forcehybrid
I Я добавил файл pods с помощью команды pod install после выполнения шагов в URL
Я реализовал код для регистрации уведомления pu sh в AppDelegate + SalesforceHybridSDK
Сейчас я не удалось получить токен устройства для приложения, (void) registerForRemoteNotifications **
вызывается успешно, но ** (void) didRegisterForRemoteNotificationsWithDeviceToken: (NSData *) deviceTokenData не вызывается после этого. Пожалуйста, найдите ниже код
- (BOOL)sfsdk_swizzled_application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
int cacheSizeMemory = 8 * 1024 * 1024; // 8MB
int cacheSizeDisk = 32 * 1024 * 1024; // 32MB
NSURLCache* sharedCache = [[SFLocalhostSubstitutionCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"];
[NSURLCache setSharedURLCache:sharedCache];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.autoresizesSubviews = YES;
[self initializeAppViewState];
[[SFPushNotificationManager sharedInstance] registerForRemoteNotifications];
__weak __typeof (self) weakSelf = self;
[SFSDKAuthHelper loginIfRequired:^{
[weakSelf setupRootViewController];
}];
return YES; // we don't want to run's Cordova didFinishLaunchingWithOptions - it creates another window with a webview
// if devs want to customize their AppDelegate.m, then they should get rid of AppDelegate+SalesforceHybrid.m
// and bring all of its code in their AppDelegate.m
}
-(void)registerForRemoteNotifications {
if (self.isSimulator) {
// remote notifications are not supported in the simulator
[SFSDKCoreLogger i:[self class] format:@"Skipping push notification registration with Apple because push isn't supported on the simulator"];
return;
}
// register with Apple for remote notifications
[SFSDKCoreLogger i:[self class] format:@"Registering with Apple for remote push notifications"];
[[SFApplicationHelper sharedApplication] performSelector:@selector(registerForRemoteNotifications)];
}
-(void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceTokenData {
[SFSDKCoreLogger i:[self class] format:@"Registration with Apple for remote push notifications succeeded"];
_deviceToken = [NSString stringWithHexData:deviceTokenData];
[[SFPreferences currentUserLevelPreferences] setObject:_deviceToken forKey:kSFDeviceToken];
}