Xcode中遇到的一些问题记录

文章讲述了在使用Unity进行iOS应用开发时遇到的两个主要问题:一是找不到*.a库文件,可能由于svn上传时忽略了这类文件;二是关于Bitcode的启用问题,提供了两种解决方案,包括手动关闭或通过脚本修改。此外,还提到了Unity接入AppleSignIn需要注意登录代码类需继承MonoBehaviour,以及苹果内购测试前需要填写银行和税务信息。
摘要由CSDN通过智能技术生成

1、build时报错,提示找不到*.a的库文件

        确认Unity项目里是否有该*.a的库文件,svn上传代码时会忽略*.a文件

2、build时提示xxx does not contain bitcode.  You must rebuild it with bitcode enabled (Xcode setting ENABLE BITCODE), obtain an updated library fromthe vendor, or disable bitcode for this target, for architecture arm64

        方法1、可以在TARGETS里的项目中,在Build Settings -> All 下,将Enable Bitcode改为No

        方法2、将以下代码保存到Editor目录下,用代码修改Enable BitCode。

using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;


class MyPostProcessor : IPostprocessBuildWithReport
{
    public int callbackOrder { get { return 0; } }
    public void OnPostprocessBuild(BuildReport report)
    {
        if (report.summary.platform == BuildTarget.iOS)
        {
            string projectPath = report.summary.outputPath + "/Unity-iPhone.xcodeproj/project.pbxproj";


            PBXProject pbxProject = new PBXProject();
            pbxProject.ReadFromFile(projectPath);


            //Disabling Bitcode on all targets


            //Main
            string target = pbxProject.GetUnityMainTargetGuid();
            pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");


            //Unity Tests
            target = pbxProject.TargetGuidByName(PBXProject.GetUnityTestTargetName());
            pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");


            //Unity Framework
            target = pbxProject.GetUnityFrameworkTargetGuid();
            pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");

            pbxProject.WriteToFile(projectPath);
        }
    }
}
#endif

3、Unity接入AppleSignInUnity时,要注意登录代码类需要继承MonoBehaviour,因为Apple登录的回调处理是在Update函数下检测处理的

4、苹果内购测试需要先填写Banking和Tax信息,不然填了内购商品也没法测

5、使用EMDU(External Dependency Manager for Unity)时,需要取消Always add the main target to Podfile的勾选,不然他会把Pod_Unity_Phone.framework添加到Build Phases下的Link Binary With Libraries里,而在build或archive时会报错说找不到Pod_Unity_Phone.framework

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值