【问题标题】:Creating a Mac Version of iOS App, build error创建 Mac 版本的 iOS 应用程序,构建错误
【发布时间】:2021-03-19 06:49:35
【问题描述】:

这是我第一次尝试创建我的 iOS 应用的 MacOs 版本。我收到以下构建错误,不知道如何解决这个问题。 任何帮助将不胜感激。

ld: building for Mac Catalyst, but linking in dylib built for iOS Simulator, file '../Pods/TwilioVideo/Build/iOS/TwilioVideo.framework/TwilioVideo' for architecture x86_64

clang: error: 链接器命令失败,退出代码为 1(使用 -v 查看调用)

【问题讨论】:

    标签: ios swift macos twilio twilio-api


    【解决方案1】:

    Twilio Video 框架看起来只支持为 iOS 构建,不支持所需的 macOS 架构。我使用的Twilio Voice 框架也是如此。

    在为 macOS 构建时,我们必须有条件地删除该依赖项。当我们使用 CocoaPods 时,我们的 Podfile 顶部有一个布尔值,指示我们是否正在尝试为 macOS 构建,我们必须在需要时手动切换它。

    例如,在你的 Podfile 中做这样的事情:

    compiling_for_ios = true # Change this when building for iOS/macOS
    
    // Other stuff in your Podfile
    
    if compiling_for_ios
       pod 'TwilioVideo'
    end
    

    【讨论】:

    • 不确定你上面写的代码是实际代码还是伪代码?我收到错误 [!] Invalid Podfile file: undefined local variable or method `compiling_for_ios' for #<:podfile:0x00007fb2e759b0e0>。
    • 应该是实际代码。我注意到if 语句在我们文件的一个函数中,但我没想到会阻止它构建。我对 Ruby 不是很熟悉。
    • compiling_for_ios$compiling_for_ios 在 Ruby 中是不同的变量。尝试添加或删除$
    • 太棒了,我也从答案中删除了 $
    猜你喜欢
    • 1970-01-01
    • 2015-09-21
    • 1970-01-01
    • 1970-01-01
    • 2015-07-06
    • 2021-08-30
    • 2021-03-04
    • 2012-07-18
    • 1970-01-01
    相关资源
    最近更新 更多