To install EMMA iOS SDK in a UNITY project, please follow this steps:
-
Insert the eMMaLibs.zip files into the Unity Plugins / iOS folder, (if no such folders exist, you must create them)
- Build the App like a XCode project.
- Look for in XCode and open UnityAppController.mm (use the file finder to find it)
- Include eMMa.h at first position with the rest of includes:
#include "eMMa.h" - Find this lines:
#if UNITY_USES_REMOTE_NOTIFICATIONS
Comment the #if UNITY_USES_REMOTE_NOTIFICATIONS and the #endif. Additionally add the next code lines:
NSLog(@"my data token is: %@", deviceToken);
NSString *deviceTokenString = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""]
stringByReplacingOccurrencesOfString: @">" withString: @""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"my string token is: %@", deviceTokenString);
[eMMa registerToken:deviceToken];
It looks something like this: - Finally look for this function:
And add the next lines just before the YES return:
[eMMa setDebuggerOutput:TRUE];
[eMMa starteMMaSession:@"losjuegosdelaguaOYxHJAQsD"];
[eMMa startPushSystem:launchOptions];
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge|UIUserNotificationTypeAlert | UIUserNotificationTypeSound) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications]; - Perfect. Your project is ready to use EMMA
0 Comments