Hello,
We are using LibGDX together with GameSparks and are working on the iOS port of our game. GameSparks comes in two possible forms :
- Sources (.h/.m files)
- CocoaPods
CocoaPods way
I have not managed to make CocoaPods work with MOE. If I go into the “xcode” folder inside my MOE module, and type pod init
, then pod install
(so even with an empty PodFile). I get this warning :
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target
ios-moeto
Pods/Target Support Files/Pods-ios-moe/Pods-ios-moe.debug.xcconfigor include the
Pods/Target Support Files/Pods-ios-moe/Pods-ios-moe.debug.xcconfigin your build configuration (
ios-moe/custom.xcconfig).
The only way I found to solve this warning was adding #include "Pods/Target Support Files/Pods-ios-moe/Pods-ios-moe.debug.xcconfig"
to my xcode/ios-moe/custom.xconfig , but it got regularly resetted for some reason, erasing my include and making the warning appear again.
When trying to run my game with pods installed, I get this error :
diff: /Podfile.lock: No such file or directory diff: /Manifest.lock: No such file or directory error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
Any idea what my mistake is here ?
Sources way
I tried the other way of using the GameSparks SDK, downloading the sources. I put them in my MOE project, in a libs/sources folder. I then used the MOE plugin to generate bindings, following this : Help with the "Create New Binding" option in 1.3.x plugin .
Here is my NBC file : https://puu.sh/xubUI/52ad3dd690.png
This generates our Java binding classes, they look good. But when I use them, the game crashes.
alloc()
and init()
work, for example, but anything not static crashes. For example this code :
GSRegistrationRequest reg = GSRegistrationRequest.alloc().init();
reg.setUserName("ios-test");
reg.setPassword("0000");
reg.setCallback(new GSRegistrationRequest.Block_setCallback() {
@Override
public void call_setCallback(GSRegistrationResponse arg0) {
System.out.println("CALLBACK OF REGISTRATION");
}
});
It crashes at reg.setUserName(“ios-test”). Same happens to setPassword or setCallback.
Here is the error :
/Users/rolandvigh/Migeran-1.3/moe/natj/natj/src/main/native/natj/NatJ.cpp:353 DEBUG: Method 'boolean java.lang.reflect.Method.isDefault()' is not accessible.
2017-09-08 03:42:34.969 iOSPORT[24042:1154233] -[GSRegistrationRequest setUserName:]: unrecognized selector sent to instance 0x7861a840
If we tick “bindings” instead of “hybrid” in the NBC file, it’s even worse :
/Users/rolandvigh/Migeran-1.3/moe/natj/natj/src/main/native/natj/NatJ.cpp:353 DEBUG: Method 'boolean java.lang.reflect.Method.isDefault()' is not accessible.
/Users/rolandvigh/Migeran-1.3/moe/natj/natj/src/main/native/natj/ObjCRuntime.mm:1478 WARNING: Binding class refers to class GSRequest, but it can not be found. Fallback to indirect super class.
/Users/rolandvigh/Migeran-1.3/moe/natj/natj/src/main/native/natj/ObjCRuntime.mm:1478 WARNING: Binding class refers to class GSRegistrationRequest, but it can not be found. Fallback to indirect super class.
2017-09-08 03:40:33.280 iOSPORT[23927:1150110] -[NSObject setUserName:]: unrecognized selector sent to instance 0x1409fd30
Note that we did not do anything in XCode. Do we need to make some kind of link between Xcode and our .h/.m files ? If so, how do we do that exactly ?
Thanks in advance