iOS构建在Codemagic中失败 [在Xcode中运行正常]

3
Xcode中构建成功,但使用Code Magic构建时失败。以下是构建失败的日志。
下面是我从Code Magic收到的输出。它显示了Firebase和Audience Network插件中的一些错误,但在Xcode中没有生成。我无法确定出现了什么确切的错误。
    == Building for iOS ==

    <span style="color:#268BD2">&gt; xcode-project use-profiles</span>
Configure code signing settings
Searching for files matching /Users/builder/Library/MobileDevice/Provisioning Profiles/*.mobileprovision

Searching for files matching /Users/builder/clone/**/*.xcodeproj
<span style="color:#859900">Completed configuring code signing settings</span>
 <span style="color:#268BD2">- Using profile "IOS Oct 2020" [-bb52-4b20-8f43-406ff4121bfb] for target "Runner" [Debug] from project "Runner"</span>
 <span style="color:#268BD2">- Using profile "IOS Oct 2020" [-bb52-4b20-8f43-406ff4121bfb] for target "Runner" [Profile] from project "Runner"</span>
 <span style="color:#268BD2">- Using profile "IOS Oct 2020" [-bb52-4b20-8f43-406ff4121bfb] for target "Runner" [Release] from project "Runner"</span>
<span style="color:#859900">Generated options for exporting IPA</span>
 <span style="color:#268BD2">- Method: app-store</span>
 <span style="color:#268BD2">- Provisioning Profiles:</span>
     <span style="color:#268BD2">- .linuxhandbook: IOS Oct 2020</span>
 <span style="color:#268BD2">- Signing Certificate: Apple Distribution</span>
 <span style="color:#268BD2">- Signing Style: manual</span>
 <span style="color:#268BD2">- Team Id: C6272K7</span>
<span style="color:#859900">Saved export options to /Users/builder/export_options.plist</span>

<span style="color:#268BD2">&gt; /usr/local/bin/flutter build ios --release --no-codesign</span>
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2. Follow the
steps at

https://flutter.dev/go/android-project-migration

to migrate your project.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building androing.linuxhandbook for device (ios-release)...
Running pod install...                                            116.1s
Running Xcode build...                                          
Xcode build done.                                           128.3s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    &lt;module-includes&gt;:1:9: note: in file included from &lt;module-includes&gt;:1:
    #import "Headers/FBAudienceNetwork.h"
            ^
    
                                     ^
    /Users/builder/clone/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources/Public/FIRMessaging.h:219:1: note: 'FIRMessagingRemoteMessage' has been explicitly marked deprecated here
    __deprecated_msg(
    ^
    In module 'UIKit' imported from /Users/builder/clone/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    In module 'Foundation' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
    In module 'Darwin' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro '__deprecated_msg'
            #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                          ^
    /Users/builder/programs/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:141:30: warning: 'shouldEstablishDirectChannel' is deprecated: FCM direct channel is deprecated, please use APNs channel for downstream message delivery. [-Wdeprecated-declarations]
        [FIRMessaging messaging].shouldEstablishDirectChannel = true;
                                 ^
    In module 'FirebaseMessaging' imported from /Users/builder/clone/ios/Pods/Headers/Public/Firebase/Firebase.h:76:
    /Users/builder/clone/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources/Public/FIRMessaging.h:283:56: note: 'shouldEstablishDirectChannel' has been explicitly marked deprecated here
    @property(nonatomic) BOOL shouldEstablishDirectChannel DEPRECATED_MSG_ATTRIBUTE(
                                                           ^
    In module 'UIKit' imported from /Users/builder/clone/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    In module 'Foundation' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
    In module 'Darwin' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/usr/include/AvailabilityMacros.h:181:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
                #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
                                                                   ^
    /Users/builder/programs/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:196:52: warning: 'appData' is deprecated [-Wdeprecated-declarations]
      [self didReceiveRemoteNotification:remoteMessage.appData];
                                                       ^
    In module 'FirebaseMessaging' imported from /Users/builder/clone/ios/Pods/Headers/Public/Firebase/Firebase.h:76:
    /Users/builder/clone/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources/Public/FIRMessaging.h:226:62: note: 'appData' has been explicitly marked deprecated here
    @property(nonatomic, readonly, strong) NSDictionary *appData DEPRECATED_ATTRIBUTE;
                                                                 ^
    In module 'UIKit' imported from /Users/builder/clone/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    In module 'Foundation' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
    In module 'Darwin' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/usr/include/AvailabilityMacros.h:179:60: note: expanded from macro 'DEPRECATED_ATTRIBUTE'
            #define DEPRECATED_ATTRIBUTE        __attribute__((deprecated))
                                                               ^
    /Users/builder/programs/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:306:1: warning: implementing deprecated method [-Wdeprecated-implementations]
    - (void)messaging:(FIRMessaging *)messaging
    ^
    In module 'FirebaseMessaging' imported from /Users/builder/clone/ios/Pods/Headers/Public/Firebase/Firebase.h:76:
    /Users/builder/clone/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources/Public/FIRMessaging.h:253:1: note: method 'messaging:didReceiveMessage:' declared here
    - (void)messaging:(FIRMessaging *)messaging
    ^
    /Users/builder/programs/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:308:63: warning: 'appData' is deprecated [-Wdeprecated-declarations]
      [_channel invokeMethod:@"onMessage" arguments:remoteMessage.appData];
                                                                  ^
    In module 'FirebaseMessaging' imported from /Users/builder/clone/ios/Pods/Headers/Public/Firebase/Firebase.h:76:
    /Users/builder/clone/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources/Public/FIRMessaging.h:226:62: note: 'appData' has been explicitly marked deprecated here
    @property(nonatomic, readonly, strong) NSDictionary *appData DEPRECATED_ATTRIBUTE;
                                                                 ^
    In module 'UIKit' imported from /Users/builder/clone/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
    In module 'Foundation' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
    In module 'Darwin' imported from /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/usr/include/AvailabilityMacros.h:179:60: note: expanded from macro 'DEPRECATED_ATTRIBUTE'
            #define DEPRECATED_ATTRIBUTE        __attribute__((deprecated))
                                                               ^
    6 warnings generated.
    /bin/sh: /Users/rushabhshah/Flutter/flutter/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'webview_flutter' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'url_launcher' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'store_redirect' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'sqflite' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'shared_preferences' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'share' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'path_provider' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'package_info' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'nanopb' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'firebase_messaging' from project 'Pods')
    warning: The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target. (in target 'Runner' from project 'Runner')
    warning: The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target. (in target 'Runner' from project 'Runner')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Protobuf' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'PromisesObjC' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'GoogleUtilities' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'GoogleDataTransport' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseMessaging' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseInstanceID' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseInstallations' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseCoreDiagnostics' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseCore' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FMDB' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'GoogleAppMeasurement' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Flutter' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'FirebaseAnalytics' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Firebase' from project 'Pods')

Encountered error while building for device.

正如输出所述,您需要将项目迁移到更新版本的Android嵌入式系统。 - koen
需要iOS构建吗?这只是一个警告!@koen - Rushabh Shah
如果你看一下构建失败的部分下面,会有很多关于弃用代码的消息,所以它可能仍然与你的崩溃有关。 - koen
谢谢您的回复。但是当我使用XCode构建相同的内容时,它可以正常工作。存档已经成功构建。只是在Code Magic中无法构建。您能否指导我一下?@koen - Rushabh Shah
抱歉,我没有使用 Code Magic 的经验。 - koen
没问题。谢谢! @koen - Rushabh Shah
4个回答

1

检查错误输出的这部分内容

/Users/rushabhshah/Flutter/flutter/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
    Command PhaseScriptExecution failed with a nonzero exit code

您使用了绝对路径/Users/rushabhshah,但在CI环境中该路径不存在。


谢谢!你能告诉我如何解决这个问题吗? - Rushabh Shah

1

将构建设置文件中的硬编码路径删除。
转到目标 - 构建设置 - 在用户定义部分 - 将FLUTTER_ROOTFLUTTER_FRAMEWORK_DIR设置为空,即删除硬编码路径
然后使用这些更改推送代码。

Code magic成功生成构建。


0

我不确定您是使用UI还是.yaml文件进行构建。如果您正在使用.yaml,请确保在构建步骤之前运行flutter packages pub get


0
我遇到了同样的问题。在我的情况下,这个脚本在codemagic.yaml文件中缺失。
xcode-project use-profiles

codemagic的日志中,这一步的最后一行内容如下:
保存导出选项至/Users/builder/export_options.plist。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接