关于Unity4.6.1 和 ios 64bit



        最近苹果要求苹果的app们都要支持64位系统。所以Untiy也在忙着做64位的适配。为了不影响Unity 的开发者的产品上线计划,Unity 在2015年1月14日发布了第一个支持64位iOS的 Unity4.6公测版本。于是我就下了个Unity4.6.1f1,发现它根本不支持arm64。没错人家说的是“发布了第一个支持64位iOS的 Unity4.6公测版本”,而不是正式版,公测版本的命名大概是Unity4.6.1px这样的不是Unity4.6.1fx。所以……

        顺便说一下升级Unity4.6.1f1后对原来Xcode工程的影响。
        由于在之前用Unity4.5的时候,我们要接入许多第三方SDK,所以我们对UnityAppController.mm做了很多修改。升级到4.6.1f1后Build Xcode工程时如果直接Append会报错,大概是“IOS81……”“IOS82……”这样的错。
        我们需要对UnityAppController.mm做如下修改:
1.将UnityInitTrampoline函数修改为:

void UnityInitTrampoline()
{
#if ENABLE_CRASH_REPORT_SUBMISSION
 SubmitCrashReportsAsync();
#endif
 InitCrashHandling();

 _ios42orNewer = [[[UIDevice currentDevice] systemVersion] compare: @"4.2" options: NSNumericSearch] != NSOrderedAscending;
 _ios43orNewer = [[[UIDevice currentDevice] systemVersion] compare: @"4.3" options: NSNumericSearch] != NSOrderedAscending;
 _ios50orNewer = [[[UIDevice currentDevice] systemVersion] compare: @"5.0" options: NSNumericSearch] != NSOrderedAscending;
 _ios60orNewer = [[[UIDevice currentDevice] systemVersion] compare: @"6.0" options: NSNumericSearch] != NSOrderedAscending;
 _ios70orNewer = [[[UIDevice currentDevice] systemVersion] compare: @"7.0" options: NSNumericSearch] != NSOrderedAscending;
 _ios80orNewer = [[[UIDevice currentDevice] systemVersion] compare: @"8.0" options: NSNumericSearch] != NSOrderedAscending;
 _ios81orNewer = [[[UIDevice currentDevice] systemVersion] compare: @"8.1" options: NSNumericSearch] != NSOrderedAscending;
 _ios82orNewer = [[[UIDevice currentDevice] systemVersion] compare: @"8.2" options: NSNumericSearch] != NSOrderedAscending;

 // Try writing to console and if it fails switch to NSLog logging
 fprintf(stdout, "\n");
 if (ftell(stdout) < 0)
  SetLogEntryHandler(LogToNSLogHandler);

    // Fix home directory environment variable.
    const char *newHomeDirectory = ([[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] UTF8String]);
    setenv("XDG_CONFIG_HOME", newHomeDirectory, 1);
    
 UnityInitJoysticks();
}


2.添加以下函数和变量

bool _ios81orNewer   = false;
bool _ios82orNewer   = false;

extern "C" const char* const* UnityFontDirs()
{
 static const char* const dirs[] = {
  "/System/Library/Fonts/Cache",  // before iOS 8.2
  "/System/Library/Fonts/AppFonts", // iOS 8.2
  "/System/Library/Fonts/Core",  // iOS 8.2
  "/System/Library/Fonts/Extra",  // iOS 8.2
  NULL
 };
 return dirs;
}


void AppController_SendMainViewControllerNotification(NSString* name)
{
 [[NSNotificationCenter defaultCenter] postNotificationName:name object:UnityGetGLViewController()];
}


如果还是不行,就不要append了,直接build一个新的Xcode工程。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值