question

Peter Samaras avatar image
Peter Samaras asked

Game Circle Login Issue Unity / iOS

Trying out Unity GameCircle compilation to iOS I followed tutorial on https://developer.amazon.com/sdk/gamecircle/documentation/unity-gamecircle-setup.html#Section3 (using Unity 4.3 and Xcode 5.0.2) when we try application crashes and then nothing: I got 2 problems: * after adding - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [GameCircle handleOpenURL:url sourceApplication:sourceApplication]; } to UnityAppController.mm I got error about duplicate function. * After compilation (disabling second version of same function) and running Demo scene and pressing top button (to login in to GameCircle) application crashed and xcode say: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: GAME_ID)' What did I miss and where ?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Dfg-777, Thank you writing to us. We have replied your query through the ContactUs case you created in the same day. I am posting the solution for other developers. Working through building a Unity project with GameCircle and IOS, when you export out the Xcode project in your UnityAppController.mm, please comment out the following method from the @implementation UnityAppController block:In Unity 4.3, this is generated at approximately line 315: //- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation //{ // NSMutableArray* keys = [NSMutableArray arrayWithCapacity:3]; // NSMutableArray* values = [NSMutableArray arrayWithCapacity:3]; // // #define ADD_ITEM(item) do{ if(item) {[keys addObject:@#item]; [values addObject:item];} }while(0) // // ADD_ITEM(url); // ADD_ITEM(sourceApplication); // ADD_ITEM(annotation); // // #undef ADD_ITEM // // NSDictionary* notifData = [NSDictionary dictionaryWithObjects:values forKeys:keys]; // AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData); // return YES; //} Then you should be able to paste in the following code into the same implementation block: -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [GameCircle handleOpenURL:url sourceApplication:sourceApplication]; } We have done this in an example scene and have been able to successfully implement an iOS implementation of our Unity project. For more information about setting up GameCircle in Unity, please refer to our setting up documentation at: https://developer.amazon.com/sdk/gamecircle/documentation/unity-gamecircle-setup.html
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rlyle avatar image
rlyle answered
HI, that seems to be an unacceptable solution since other plugins may rely on the event being sent out by the default code. I'm hitting the following error when we try to initialize GameCircle to support logins into amazon for iOS: 014-03-19 12:35:24.690 KIUnityUnitTest[8957:907] W GameCircle has not been initialized yet. 2014-03-19 12:35:24.714 KIUnityUnitTest[8957:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: GAME_ID)' *** First throw call stack: (0x341742a3 0x3bfdd97f 0x340d6313 0xde3ef3 0xde3bff 0xdf8017 0xdf7bc1 0xe027a9 0xe03643 0xdd8523 0x3c3f44b7 0x3c3fa3f7 0xdd8495 0xddcc29 0xe4fe87 0xe7e24 0x82e80 0x8578c 0xc6f3e0 0x14918c0 0x1534958 0xfe8880 0x107b01c 0x107afcc 0x107af78 0x105ea54 0x105e7a8 0x106f828 0x106faac 0x12c9714 0x870f78 0x44e90 0x445d4 0x81b78 0xc6f3e0 0x14918c0 0x1534958 0xfe8880 0x107b650 0x106f200 0x1019148 0x1018d48 0x1019100 0x104bd68 0xe92674 0xdc2794 0xdc285c 0x3975b3b 0x35d61099 0x35d60ff1 0x37fbafd7 0x34d5b449 0x3413e5db 0x34149173 0x34149117 0x34147f99 0x340baebd 0x340bad49 0x37c6f2eb 0x35fd0301 0x8290 0x3c414b20) libc++abi.dylib: terminate called throwing an exception (lldb)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rlyle avatar image
rlyle answered
P.S. I hit some other issues with duplicate symbols as well that I managed to resolve... 1) Removed the AmazonInsightsSDK.a from our project, since symbols were conflicting with the libGameCircleUnityProxy.a project. 2) the symbol _kClientId in GameCircle.a was conflicting with a symbol from static libraries from another 3rd party, so I had to use a hex editor and rename that symbol to _kclientId. I'm trying to implement multiple 3rd party login support for multiple mobile projects. Amazon is my last 3rd party I need to finish up to support, all others are working fine currently on IOS. I just need to resolve this crash that occurs when we try to initialize Amazon :(
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Rlyle, It looks like from the exception that is being thrown that you most likely isn’t making the appropriate modifications to the project’s info.plist file to specify the API key. Please refer our GameCircle iOS configuration documentation here: https://developer.amazon.com/appsandservices/apis/engage/gamecircle/docs/setting-up-ios since at the point you are getting these errors, it is after Unity spit out the appropriate Xcode project, so you will need to fix the plist prior to compilation. I agree about the pain points for having error due to duplicate symbol used in GameCircle iOS SDK. I would like to bring attention of concerned team here to address this issue. Can you please provide below information? 1. What are the other plugins you are using, whose symbols are crashing with our SDK? 2. Is that possible a list of problematic symbols of our current version of SDK so that I can forward those to the team here? You should be able to figure out that you can actually look at the URL scheme and if it begins with amzn, use GameCircle, otherwise continue with the standard method as written by Unity.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.