用unity开发ios程序,必须要用到xcode吗
1个回答
2016-03-28 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
第一步:导出的东西肯定先会在xcode里跑一下,可能出现如下问题
u3d中调用ios方法:
一开始拿到u3d源码,导出xcode项目时出现如下报错
Undefined symbols for architecture armv7:
"_ios_onUnwearedClothes", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_ios_onLoadUnityPlayerOK", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_ios_onClothesWeared", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_ios_onClothesSelected", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
4.0版本的u3d导出的xcode项目是appController,但4.6版导出后是UnityAppController
上面的报错是因为在xcode中没有提供上面这些方法,要手动写到UnityAppController里
在UnityAppController.h中添加:
注意方法是否需要传入参数或返回值,我这里都是无参数无返回值的
#ifdef __cplusplus
extern "C" {
#endif
void ios_onUnwearedClothes();
void ios_onLoadUnityPlayerOK();
void ios_onClothesWeared();
void ios_onClothesSelected();
#ifdef __cplusplus
}
#endif
在UnityAppController.m中实现这些方法:
void ios_onUnwearedClothes()
{
// do something
}
void ios_onLoadUnityPlayerOK()
{
// do something
}
void ios_onClothesWeared()
{
// do something
}
void ios_onClothesSelected()
{
// do something
}
u3d中调用ios方法:
一开始拿到u3d源码,导出xcode项目时出现如下报错
Undefined symbols for architecture armv7:
"_ios_onUnwearedClothes", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_ios_onLoadUnityPlayerOK", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_ios_onClothesWeared", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
"_ios_onClothesSelected", referenced from:
RegisterMonoModules() in RegisterMonoModules.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
4.0版本的u3d导出的xcode项目是appController,但4.6版导出后是UnityAppController
上面的报错是因为在xcode中没有提供上面这些方法,要手动写到UnityAppController里
在UnityAppController.h中添加:
注意方法是否需要传入参数或返回值,我这里都是无参数无返回值的
#ifdef __cplusplus
extern "C" {
#endif
void ios_onUnwearedClothes();
void ios_onLoadUnityPlayerOK();
void ios_onClothesWeared();
void ios_onClothesSelected();
#ifdef __cplusplus
}
#endif
在UnityAppController.m中实现这些方法:
void ios_onUnwearedClothes()
{
// do something
}
void ios_onLoadUnityPlayerOK()
{
// do something
}
void ios_onClothesWeared()
{
// do something
}
void ios_onClothesSelected()
{
// do something
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询