Apportable SDK - Objective-C / Cocoa Touch for Android
The Apportable SDK is a product that allows you to compile a game (or application) developed on Objective-C / Cocoa Touch for iOS without Android changes. This is a complete toolchain (compiler, debugger, linker-all-all-all), working Foundation, CoreFoundation, UIKit, many other iOS frameworks ported to Android (even such a “trifle” as GameKit and StoreKit, with backends for GooglePlus and Amazon GameCircle / Appstore).
The goal of Apportable is to let the iOS developer transfer their application to Android in an hour, without changing the code, and after that maintain one code base. How to port a simple toy to cocos2d - under a cat
Go to the Apportable website .
After registrationwe are given the SDK deflate, a user-specific link.
It will be pumped out for a very long time - Apportable uses patched android-sdk, ndk and other heavy artillery.
After installation, it will say: So we do:
Now we’ll deflate our experimental rabbit, some random open source open source game from the github , sawn down on Objective-C / Cocos-2d (apportable cocos2d support is especially good, they are even the official cocos2d sponsor ). Disclaimer: the author has nothing to do with the experimental game, it’s completely not adapted for the Apportable SDK, just a game on cocos2d
Check to compile from Xcode:
We connect the beloved Nexus (or galaxy, or non-Chinese without google-apps - there is almost no difference), run the utility that will create climbers.approj (this is a set of settings for Apportable, which are superimposed on top of .xcodeproj), compile the project and upload it to device:
The utility will first ask: The toy uses Cocos2D 1.X, so we answer “1”, the second question is “p”. After the first attempt, the compilation falls off with error messages: It complains about the missing AudioFile * functions ... Google suggests that they are in the AudioToolbox framework . Well…
In the " add_params " section we find the lines:
We fix on:
The game is loaded on a connected Android mobile phone, there is even sound. The graphics have gone a bit - the developer did not count on the different resolutions of the androidophones, however, this is easy (and necessary) to fix, if you adapt the graphics too lazy, Apportable presents a workaround that will scale the graphics as if the game was running on an iOS device. Let's try the second way:
In the beginning - [AppDelegate applicationDidFinishLaunching:] add:
Here we set the best emulation mode for the device - if its resolution / proportions are similar to the iPad - it will emulate the iPad, if on the iPhone - iPhone.
It is also worth removing the unnecessary orientation selection code:
Save, run the apportable load command . We see an Objective-C / Cocos 2d toy on the Nexus:

Fork toys after porting to Android. Only one alias file is added, changed in five lines AppDelegate
complete listing of the session porting
available documentation and mailing list . Our specially trained engineers also monitor the tag on StackOverflow . Video session porting tweejump .
Starter edition of the SDK is free , supported by Android 4+. Apportable is best suited for porting games - applications still have different UI guidelines, and games are already run onmany leaders of appstore . I will be happy to answer any questions, in the next article I’m going to tell you how to quickly and painlessly tear out the bugs that arise when porting and transparently, without changing the code base, integrate social frameworks, StoreKit and GameKit.
The goal of Apportable is to let the iOS developer transfer their application to Android in an hour, without changing the code, and after that maintain one code base. How to port a simple toy to cocos2d - under a cat
Go to the Apportable website .
After registrationwe are given the SDK deflate, a user-specific link.
It will be pumped out for a very long time - Apportable uses patched android-sdk, ndk and other heavy artillery.
After installation, it will say: So we do:
Toolchain downloaded into /Users/darvin/.apportable/toolchain.
Apportable CLI is successfully installed at /Users/darvin/.apportable/SDK/bin/apportable
If you're using the default shell, add the Apportable CLI to your PATH using:
(echo; echo 'PATH="/Users/darvin/.apportable/SDK/bin:$PATH"') >> ~/.bash_profile; source ~/.bash_profile
$ echo; echo 'PATH="/Users/darvin/.apportable/SDK/bin:$PATH"') >> ~/.bash_profile; source ~/.bash_profile
Now we’ll deflate our experimental rabbit, some random open source open source game from the github , sawn down on Objective-C / Cocos-2d (apportable cocos2d support is especially good, they are even the official cocos2d sponsor ). Disclaimer: the author has nothing to do with the experimental game, it’s completely not adapted for the Apportable SDK, just a game on cocos2d
$ git clone https://github.com/haqu/climbers.git
$ cd climbers
Check to compile from Xcode:
$ open climbers.xcodeproj
We connect the beloved Nexus (or galaxy, or non-Chinese without google-apps - there is almost no difference), run the utility that will create climbers.approj (this is a set of settings for Apportable, which are superimposed on top of .xcodeproj), compile the project and upload it to device:
$ apportable load
The utility will first ask: The toy uses Cocos2D 1.X, so we answer “1”, the second question is “p”. After the first attempt, the compilation falls off with error messages: It complains about the missing AudioFile * functions ... Google suggests that they are in the AudioToolbox framework . Well…
If the app is using OpenGL ES, does it use ES1 or ES2? (Cocos2D 1.X uses ES1, 2.X uses ES2)
[1/2] 1
Should the app initially launch in landscape or portrait orientation? (default: landscape)
[L/p] p
/Users/darvin/GAMES/climbers/Support/CocosDenshion/CDAudioManager.m:322: error: undefined reference to 'AudioSessionGetProperty'
/Users/darvin/GAMES/climbers/Support/CocosDenshion/CDAudioManager.m:382: error: undefined reference to 'AVAudioSessionCategoryPlayAndRecord'
...вырезано...
/Users/darvin/GAMES/climbers/Support/CocosDenshion/CDOpenALSupport.m:227: error: undefined reference to 'ExtAudioFileDispose'
Updating Jar...
scons: *** [Build/android-armeabi-debug/climbers/apk/lib/armeabi/libverde.so] Error 1
scons: building terminated because of errors.
$ vim climbers.approj/configuration.json
In the " add_params " section we find the lines:
// A list of dependencies. Typically these correspond to
// frameworks in the xcode project.
"deps": [""],
We fix on:
"deps": ["AudioToolbox"],
$ apportable load
The game is loaded on a connected Android mobile phone, there is even sound. The graphics have gone a bit - the developer did not count on the different resolutions of the androidophones, however, this is easy (and necessary) to fix, if you adapt the graphics too lazy, Apportable presents a workaround that will scale the graphics as if the game was running on an iOS device. Let's try the second way:
In the beginning - [AppDelegate applicationDidFinishLaunching:] add:
#ifdef APPORTABLE
[UIScreen mainScreen].currentMode =
[UIScreenMode emulatedMode:UIScreenBestEmulationMode];
#endif
Here we set the best emulation mode for the device - if its resolution / proportions are similar to the iPad - it will emulate the iPad, if on the iPhone - iPhone.
It is also worth removing the unnecessary orientation selection code:
#if GAME_AUTOROTATION == kGameAutorotationUIViewController
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
#else
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
#endi
Save, run the apportable load command . We see an Objective-C / Cocos 2d toy on the Nexus:

Fork toys after porting to Android. Only one alias file is added, changed in five lines AppDelegate
complete listing of the session porting
available documentation and mailing list . Our specially trained engineers also monitor the tag on StackOverflow . Video session porting tweejump .
Starter edition of the SDK is free , supported by Android 4+. Apportable is best suited for porting games - applications still have different UI guidelines, and games are already run onmany leaders of appstore . I will be happy to answer any questions, in the next article I’m going to tell you how to quickly and painlessly tear out the bugs that arise when porting and transparently, without changing the code base, integrate social frameworks, StoreKit and GameKit.