当前位置:编程学习 > wap >>

unity 3d 调用ios中的方法的问题 xcode 5 ios7 unity4.2.1(mac)

根据Unity3D研究院之Unity3D回馈IOS高级界面消息(十)
http://www.xuanyusong.com/archives/521
的步骤想实现 Unity3d 调用 ios中的方法。
但是一直没有效果。

这是绘制GUI,已正常显示
void OnGUI()
{
if(GUI.Button(new Rect(300,50,140,140),button1))
{
jSDK.ActivateButton1();
}

if(GUI.Button(new Rect(500,50,140,140),button2))
{
jSDK.ActivateButton2();
}
}

SDK文件,调试断点进来了。
  [DllImport("__Internal")]
 private static extern void _PressButton1();

public static void ActivateButton1()
{
//if(Application.platform != RuntimePlatform.OSXEditor)
//{

Debug.Log("Before _PressButton1");
_PressButton1();
Debug.Log("After _PressButton1");
//}
}

[DllImport("__Internal")]
 private static extern void _PressButton2();

public static void ActivateButton2()
{
//if(Application.platform != RuntimePlatform.OSXEditor)
//{
Debug.Log("Before _PressButton2");
              
_PressButton2();
    Debug.Log("After _PressButton2");
//}
}
这是生成的xcode工程,之后我添加了一个ios页面文件中的
.m 文件,页面也显示正常了(按照步骤在UnityAppController添加显示UI的)
void _PressButton1()
{
    UIAlertView *alertview=[[UIAlertView alloc] initWithTitle:@"button1" message:@"sd" delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alertview show];
}

void _PressButton2()
{
    UIAlertView *alertview=[[UIAlertView alloc] initWithTitle:@"button2" message:@"sd" delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alertview show];
}

请问下还要注意什么?
为什么我在Unity3d中点击按钮
都没有调出ios的弹出信息框呢?
--------------------编程问答-------------------- 我也遇到这种问题  不调用iOS中的方法  也是看Unity3D研究院之Unity3D回馈IOS高级界面消息(十)这个教程做的.....同求解答啊
补充:移动开发 ,  iPhone
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,