守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 2491|回复: 0

[IOS] 开发腾讯移动游戏平台SDK ios版Ane扩展 总结

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52584
    钢镚
    1422

    开源英雄守望者

    发表于 2015-1-15 13:14:33 | 显示全部楼层 |阅读模式
    本帖最后由 破晓 于 2015-1-19 15:04 编辑

    本文记录了在开发 腾讯移动游戏平台SDK(MSDK) ios版Ane扩展 过程中所遇到的问题

    文中很多问题都是基础的问题、对object c和xcode配置了解不深入导致的。(没办法,开发ane的程序员大部分都是做ActionScript的,一般对c/c++都没有开发经验)



    问题一、编译报错:Unexpected ‘@’ in program


    代码如下:


    1. @try{
    2. }
    3. @catch{
    4. }</font></font>
    复制代码
    原因是高版本xcode代码放在低版本xcode下跑,低版本ios 不支持这种写法(ios 7.0编译正常),需要修改设置ios Deployment Target属性
    如果要支持安装在低版本的ios上,则不能用这种写法----待确认??

    问题二、c++代码和object-c混合编译,会报错:Cannot use '@try' with Objective-C exceptionsdisabled



    解决办法:修改target -> build settings -> All | Combined -> Apple LLVMCompiler 5.0 - Language - Objective C 中 EnableObjective-C Exceptions 为YES

    问题三、编译报错 instance method '-AddList:' not found (returntype defaults to 'id')


    原因1:没有import .h文件,只通过 @class file 方式引用了文件,解决方法是 把文件import进来
    http://blog.csdn.net/liuyuyefz/article/details/8189210
    原因2:实例方法和静态方法搞错了


    问题四、项目移植到另一个版本ide后编译报错
    1. Unsupported compiler 'com.apple.compilers.llvmgcc42' selected forarchitecture 'armv7'
    2. Unableto determine concrete GCC compiler for file/Users/flash8/Desktop/app/TencentMSDKAneIOS/TencentMSDKAneIOS/TencentMSDKAneIOS.mof type sourcecode.c.objc.
    复制代码
    原因是xcode版本不同,编译器不一样了,解决方法:
    设置 Build Settings-> Build Options -> Compiler for C/C++/Objective-C 选择DefaultComplier (Apple LLVM 5.1)


    问题五、打包时报错:ld: framework not found AdSupport


    原因是platformoptions.xml中未添加在上添加AdSupportframework,注意(低于IOS 6.0系统需要在xcode中设置为Optional)
    1. <option>-frameworkAdSupport</option>
    复制代码
    问题六、打包时报错:-[GDataXMLElement attributeForName]......一大段



    原因是platformoptions.xml中未添加在上添加libxml2
    1. <option>-lxml2</option>
    复制代码
    问题七、打包时报错:
    1. Undefined symbols for architecture armv7:  
    2. "_TencentMSDKAneIOSExtInitializer",referenced from:
    3.      _g_com_adobe_air_fre_fmap in extensionglue.o
    4.      (maybe you meant:_TencentMSDKAneIOSExtInitializer_name)
    5. "_TencentMSDKAneIOSExtInitializer",referenced from:
    6.      _g_com_adobe_air_fre_fmap in extensionglue.o
    7.      (maybe you meant:_TencentMSDKAneIOSExtFinalizer_name)
    8. ld:symbol(s) not found for architecture armv7
    9. Compilationfailed while executing : ld64
    复制代码
    找了好久,一直怀疑是类库漏了或配置错误,后来发现原因是 c++把函数名翻译了(这个项目包含c++代码)
    解决办法是在头文件中用extern c把那两入口函数包住
    1. #if__cplusplus
    2. extern"C" {
    3. #endif
    4. void *TencentMSDKAneIOSExtInitializer();
    5. void *TencentMSDKAneIOSExtInitializer();
    6. #if__cplusplus
    7. }  // Extern C
    8. #endif
    复制代码
    参考链接:http://stackoverflow.com/questio ... in-objective-c-code




    问题八、#import<vector> 编译时提示错误“vector.h file not found”



    原因是项目中引入了C++ STL里的vector.h文件,编译器的配置不对,修改如下配置即可:
    1. 选择project -> build setting -> apple LLVM compiler 3.0 – language配置项,
    2. 将Compile Sources As设置项修改为Objective-C++。


    【原文链接:http://blog.csdn.net/linguifa/article/details/25741807/  转载请注明出处】



    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2024-3-19 16:23 , Processed in 0.051754 second(s), 35 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表