# Call native plug-ins for iOS

> Wrap native code in C# layer to only run code when using an iOS device.

Your app can only call iOS native plug-ins when deployed on an actual device. Wrap all native code methods with an additional C# code layer to only call native methods when the app is running on a device. Store this C# file in your Project's `Assets` folder.

This C# layer can use [platform conditional compilation](/engine/6000.3/manual/programming-environment/script-compilation/conditional-compilation/platform-dependent-compilation.md) or check [`Application.platform`](/engine/6000.3/script-reference/unityengine/application/platform.md). For code running in the Unity Editor, return placeholder values.

Refer to the following sections for simple implementations of these methods. For a more detailed implementation, refer to [Unity native plug-in example for iOS](/engine/6000.3/manual/platform-specific/iphone/ios-developing/plugins-for-ios/ios-native-plugin-use/bonjour-sample.md).

## Use conditional compilation

Platform dependent compilation is faster than `Application.platform` as it's evaluated at compile time, rather than runtime.

Use the following to implement conditional compilation:

```lang-cs
void MyMethod()
{
#if UNITY_IOS && !UNITY_EDITOR
    CallNativeMethodImplementation();
#else
    CallEditorMethodImplementation();
#endif
}
```

## Check Application.platform

Use the following to implement [`Application.platform`](/engine/6000.3/script-reference/unityengine/application/platform.md) and return placeholder values in the Editor:

```lang-cs
void MyMethod()
 {
	if (Application.platform != RuntimePlatform.OSXEditor)
	{
		return _GetLookupStatus();
	}
	else
	{
		return "Done";
	}
}
```

## Additional resources

* [Callback from native code](/engine/6000.3/manual/platform-specific/iphone/ios-developing/plugins-for-ios/ios-native-plugin-use/call-back.md)
* [Unity native plug-in example for iOS](/engine/6000.3/manual/platform-specific/iphone/ios-developing/plugins-for-ios/ios-native-plugin-use/bonjour-sample.md).
