Open iOS application from Unity
The other application needs to support that behaviour, by defining a custom url scheme.
The developer needs add an URL Type i.e. "awesomeapp" in Xcode under Targets > Info > URL Types, if he does not support it you can not open the app.
In your Unity app just call
Application.OpenURL("awesomeapp://").
see also this stackoverflow entry:
Launch an app from within another (iPhone)
UPDATE 1: how to find a custom URL scheme of 3rd party app
- Download the purchased app via iTunes on OSX
- Go to the [AppName].ipa file on your filesystem
- Rename it to a [AppName].zip so that you can extract it
- Go to "[AppName]/Payload/[AppName].app"
- Right click and select "Show Package Contents"
- Open the Info.plist in Xcode and look for the key URL types or in a text editor for CFBundleURLTypes.
UPDATE 2: iOS 9
For iOS 9 you must whitelist that application in the Info.plist of the Xcode Project:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>awesomeapp</string>
</array>
Open Settings application on Unity iOS
You need to write a tiny iOS plugin for that, here is more information about it: http://docs.unity3d.com/Manual/PluginsForIOS.html
And here is your solution, ask if something should be unclear.
Script/Example.cs
using UnityEngine;
public class Example
{
public void OpenSettings()
{
#if UNITY_IPHONE
string url = MyNativeBindings.GetSettingsURL();
Debug.Log("the settings url is:" + url);
Application.OpenURL(url);
#endif
}
}
Plugins/MyNativeBindings.cs
public class MyNativeBindings
{
#if UNITY_IPHONE
[DllImport ("__Internal")]
public static extern string GetSettingsURL();
[DllImport ("__Internal")]
public static extern void OpenSettings();
#endif
}
Plugins/iOS/MyNativeBindings.mm
extern "C" {
// Helper method to create C string copy
char* MakeStringCopy (NSString* nsstring)
{
if (nsstring == NULL) {
return NULL;
}
// convert from NSString to char with utf8 encoding
const char* string = [nsstring cStringUsingEncoding:NSUTF8StringEncoding];
if (string == NULL) {
return NULL;
}
// create char copy with malloc and strcpy
char* res = (char*)malloc(strlen(string) + 1);
strcpy(res, string);
return res;
}
const char* GetSettingsURL () {
NSURL * url = [NSURL URLWithString: UIApplicationOpenSettingsURLString];
return MakeStringCopy(url.absoluteString);
}
void OpenSettings () {
NSURL * url = [NSURL URLWithString: UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL: url];
}
}
Unload & quit Unity from an external iOS App
When using the "Unity as a Library" Feature to integrate Unity into your native iOS application you won't be able to fully terminate Unity and return to your native App.
As stated in the Unity Documentation on integrating Unity into native iOS applications you are able to call the method - (void)unloadApplication;
on the UnityFramework instance to release most of the memory it occupies, but not all of it. You will be able to run Unity again after doing so.
Related Topics
How to Set PDF Paragraph or Font Line-Height with Itextsharp
The Controls Collection Cannot Be Modified Because the Control Contains Code Blocks (I.E. <% ... %>)
Print HTML Document from Windows Service in C# Without Print Dialog
Visual Studio 2012 Conditional Bundling
Xamarin: Android: System.Unauthorizedaccessexception: Access to The Path Is Denied
Webbrowser Component Not Showing CSS 3
How to Parse an HTML String for Image Tags to Get at The Src Information
How to Create a Progress Bar with Rounded Corners in iOS Using Xamarin.Forms
Feasibility of C# Development with Mono
How to Add a CSS Class to an Updatepanel in Asp.Net
How to Inject JavaScript in The Wp7 Webbrowser Control
How Does Java's Use-Site Variance Compare to C#'s Declaration Site Variance
Download a File from Azure Devops Server Writes Wrong Data to The File