"To use your own plugin, you first need to write C functions to access the functions you need and compile them into a library. In Unity, you will also need to create a C # script that calls the functions in the native library." from http://docs.unity3d.com/Manual/NativePlugins.html
So basically you need to write your code in Objective-C and provide the connection between Unity and Native Code.
The code you need to implement to check Facebook APP;
(void) checkFacebookApp
{
if ([[UIApplication sharedApplication] canOpenURL:[NSURLURLWithString:@"fb://"]])
{
return true;
}
}
However, you need some connection between the Unity project and Xcode. In this way,
class SomeScript : MonoBehaviour {
#if UNITY_IPHONE || UNITY_XBOX360
[DllImport ("__Internal")]
#else
[DllImport ("PluginName")]
#endif
private static extern float checkFacebookApp ();
void Awake () {
bool check = checkFacebookApp ();
}
}
source
share