Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The following method should be used for registering the application into the APNS system in Aşağıdaki yöntem AppDelagate's didFinishLaunchingWithOptions methodnin didFinishLaunchingWithOptions yönteminde APNS sistemine uygulama kaydı için kullanılmalıdır:

Code Block
languageapplescript
titleObjective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
	if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeAlert| UIUserNotificationTypeBadge| UIUserNotificationTypeSound) categories:nil];
        [application registerUserNotificationSettings:settings];
    } else {
        UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
        [application registerForRemoteNotificationTypes:myTypes];
    }
}

...

Code Block
languageapplescript
titleSwift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
	if #available(iOS 8.0, *) {
        let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
        UIApplication.shared.registerUserNotificationSettings(settings)
        UIApplication.shared.registerForRemoteNotifications()
    } else {
        UIApplication.shared.registerForRemoteNotifications(matching: ([.badge, .sound, .alert]))
    }
}


To send users push messages Visilabs servers need to receive tokens. To achieve this customEvent method need to be called passing Kullanıcılara push mesaj göndermek için RMC sunucularının Token alması gerekir. Bu customEvent yöntemini başarmak için OM.sys.AppID and AppID ve OM.sys.TokenID parameters. To learn the value of parametrelerini iletmek gerekir. OM.sys.AppID parameter send a request to RMC support. The value of token which is generated by APNS will be the value of parametresinin değerini öğrenmek için RMC destek ekibiyle iletişime geçiniz. APNS tarafından üretilen token değeri OM.sys.TokenID key anahtarının değeri olacaktır.


Code Block
languageapplescript
titleObjective-C
- (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    NSString *tokenString = [[[deviceToken description] stringByTrimmingCharactersInSet:
                              [NSCharacterSet characterSetWithCharactersInString:@"<>"]]
                             stringByReplacingOccurrencesOfString:@" " withString:@""];
    NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
    [dic setObject:tokenString forKey:@"OM.sys.TokenID"];
    [dic setObject:@"AppID" forKey:@"OM.sys.AppID"];
    [[Visilabs callAPI] customEvent:@"RegisterToken" withProperties:dic];
}

...