Inside the CastleEngineManifest.xml you can declare which additional services you want to integrate with your iOS application. It looks like this:
<?xml version="1.0" encoding="utf-8"?> <project name="castle_spine" game_units="GameInitialize"> <ios> <services> <service name="apple_game_center" /> </services> </ios> </project>
activity_recognition
apple_game_center
facebook
fmod
freetype
game_analytics
icloud_for_save_games
in_app_purchases
ogg_vorbis
photo_service
tenjin
test_fairy
vibrate
Some of the services use CocoaPods for installing 3rd-party dependencies easily (e.g. Game Analytics or Google Analytics or Facebook SDK libraries).
In order to use such sevices:
You need to have CocoaPods installed on your system. Just execute sudo gem install cocoapods in the terminal, it should make the pod command available on your $PATH.
sudo gem install cocoapods
pod
$PATH
The build tool will internally use pod to download and install service dependencies. This happens completely automatically. If you never used CocoaPods before, be aware that the 1st run may take a while (even a couple of minutes) as a large CocoaPods repository is downloaded.
You should no longer open the project using my_project_name.xcodeproj file. This will not work, as the libPods... library will not be built in this case. Instead, open and run in Xcode the my_project_name.xcworkspace file (it is in the same directory as my_project_name.xcodeproj). Using this will correctly build and run the project with dependencies.
my_project_name.xcodeproj
libPods...
my_project_name.xcworkspace
If you have installed the pod command using above instructions, and executing the pod --version in terminal works for you OK, but the CGE editor says that it "Cannot find pod command", then try a workaround: execute the editor from the command-line. Type in the terminal <location-where-you-downloaded-engine>/castle_game_engine/bin/castle-editor.app/Contents/MacOS/castle-editor and press <Enter>. Try to build iOS application from that editor.
pod --version
<location-where-you-downloaded-engine>/castle_game_engine/bin/castle-editor.app/Contents/MacOS/castle-editor
The more long-term solution would be to add the path to pod to CGE GUI application, but it’s not as straightforward on various macOS versions (see pointers here).
Adding new iOS service is deliberately very consistent with creating new service for Android, which is documented on Adding New Android Services.
In case of iOS you write code using Objective-C.
Similarly to Android, we have a base class in Objective-C ServiceAbstract with methods you can override, that correspond to typical iOS application lifecycle.
ServiceAbstract
See existing service code build-tool/data/ios/services for examples.
build-tool/data/ios/services
Same as on Android, you can use CastleMessaging to communicate with Pascal code asynchronously.
CastleMessaging
On iOS, use static libraries libxxx.a (instead of dynamic libxxx.so).
libxxx.a
libxxx.so
Note that CocoaPods has a lot of common libraries available. You can trivially use Podfile inside a service to reference any library from CocoaPods. See e.g. freetype service on iOS for an example.
Podfile
To improve this documentation just edit this page and create a pull request to cge-www repository.