Unity3d iOS Plugin / iOS Bridge for communicating with iOS Native Code from Unity
Example of how to use the iOSPlugin:
iOSPlugin.ShowAlert("Hello", "World");
iOSPlugin.ShowAlertConfirmation("Basic Alert Confirmation", "Hello this is a basic confirmation !", "CallBack");
iOSPlugin.ShareMessage("Welcome To iOS Bridge Essentials", "https://www.github.com/dilmerv/UnityiOSBridgeEssentials");
iOSPlugin.GetBatteryStatus()
// possible statuses are return in the BatterStatus enum
public enum BatteryStatus
{
UIDeviceBatteryStateUnknown = 0,
UIDeviceBatteryStateUnplugged = 1,
UIDeviceBatteryStateCharging = 2,
UIDeviceBatteryStateFull = 3
}
iOSPlugin.GetBatteryLevel()
bool success = iOSPlugin.iCloudSaveStringValue(ICLOUD_KEY, valueToSave);
string savedValue = iOSPlugin.iCloudGetStringValue(ICLOUD_KEY);
Be sure to include the entitlement below otherwise icloud key value store will not work
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.icloud-container-identifiers</key>
<array/>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
</dict>
</plist>
bool success = iOSPlugin.iCloudSaveIntValue(ICLOUD_KEY, valueToSave);
int savedValue = iOSPlugin.iCloudGetIntValue(ICLOUD_KEY);
bool success = iOSPlugin.iCloudSaveBoolValue(ICLOUD_KEY, valueToSave);
bool savedValue = iOSPlugin.iCloudGetBoolValue(ICLOUD_KEY);