Effect:
Code: "GitHub" Unity_ios_plugin_demo
Key: 1, Unity calls ios:1.1, in Unity C #:
[DllImport ("__internal")]private static extern int _showselecttitledialog (string title, String msg);
1.2. In Xcode objective-c:
extern "C" { int _showselecttitledialog (const char *title, const char *msg) { return [[Undialogmanager Sharedmana GER] showselectdialog:[nsstring Stringwithutf8string:title] message:[nsstring stringwithutf8string:msg] ; }}
2. Call unity:2.1 in iOS, in Xcode objective-c:
Unitysendmessage ("Dialogmanager", "OnCancel", tag. utf8string);
2.2. In Unity C #:
public void OnCancel (string idstr) { int id = Int. Parse (IDSTR); if (_delegates. ContainsKey (ID)) { _delegates [id] ( -1); _delegates. Remove (ID); Debug.logwarning ("===oncancel idStr1:" + idstr); } else { debug.logwarning ("===oncancel idStr2:" + idstr);} }
Reference: http://docs.unity3d.com/Manual/PluginsForIOS.htmlhttps://github.com/asus4/UnityNativeDialogPluginhttp:// blog.csdn.net/wwmusic/article/details/21008289
Document Information
- Original URL: http://blog.csdn.net/cdztop/article/details/39805803
- Last modified: October 05, 2014 20:58
Mutual invocation between unity and iOS native code