Codemagic IOS 构建 - 无法构建 iOS 应用程序 - 原因是什么?

问题描述

我正在尝试为 IOS 构建我的应用。

我有 windows + Flutter/Dart 没有 IOS 开发工具。

使用 Codemagic 为 Android 版本构建和用于 IOS 的简单签名应用程序顺利完成。 IPHONEOS_DEPLOYMENT_TARGET = 12.0;

附加主应用程序的 Codemagic 构建日志

警告是失败的原因吗?

他们的主要问题是什么?

> Flutter build ipa --release --export-options-plist /Users/builder/export_options.plist -t lib/main_app1.dart

Running "Flutter pub get" in clone...                           
 1,418ms

Archiving com.xxx...
Upgrading contents.xcworkspacedata

Automatically signing iOS for device deployment using specified development team in Xcode project: xxxxx

Running pod install...                                          
   20.3s

Running Xcode build...                                          

Xcode archive done.                                         108.4s

Failed to build iOS app
Error output from Xcode build:
↳
    ** ARCHIVE Failed **


Xcode's output:
↳
    2 warnings generated.
    /Users/builder/programs/Flutter_2_0_3/.pub-cache/hosted/pub.dartlang.org/geolocator-7.0.1/ios/Classes/GeolocatorPlugin.m:199:11: warning: 'openURL:' is deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
              openURL:[NSURL URLWithString:UIApplicationopenSettingsURLString]];
              ^~~~~~~
              openURL:options:completionHandler:
    In module 'UIKit' imported from /Users/builder/clone/ios/Pods/Target Support Files/geolocator/geolocator-prefix.pch:2:
    /Applications/Xcode-12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:123:1: note: 'openURL:' has been explicitly marked deprecated here
    - (BOOL)openURL:(NSURL*)url API_DEPRECATED_WITH_REPLACEMENT("openURL:options:completionHandler:",ios(2.0,10.0)) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    1 warning generated.
    /Users/builder/programs/Flutter_2_0_3/.pub-cache/hosted/pub.dartlang.org/Flutter_phone_direct_caller-1.0.1/ios/Classes/FlutterPhoneDirectCallerPlugin.m:24:22: warning: 'stringByAddingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead,which always uses the recommended UTF-8 encoding,and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid. [-Wdeprecated-declarations]
        number = [number stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                         ^
    In module 'UIKit' imported from /Users/builder/clone/ios/Pods/Target Support Files/Flutter_phone_direct_caller/Flutter_phone_direct_caller-prefix.pch:2:
    In module 'Foundation' imported from /Applications/Xcode-12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    /Applications/Xcode-12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURL.h:595:1: note: 'stringByAddingPercentEscapesUsingEncoding:' has been explicitly marked deprecated here
    - (nullable Nsstring *)stringByAddingPercentEscapesUsingEncoding:(nsstringencoding)enc API_DEPRECATED("Use -stringByAddingPercentEncodingWithAllowedCharacters: instead,and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid.",macos(10.0,10.11),9.0),watchos(2.0,2.0),tvos(9.0,9.0));
    ^
    /Users/builder/programs/Flutter_2_0_3/.pub-cache/hosted/pub.dartlang.org/Flutter_phone_direct_caller-1.0.1/ios/Classes/FlutterPhoneDirectCallerPlugin.m:30:51: warning: 'openURL:' is deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
        } else if(![[UIApplication sharedApplication] openURL:[NSURL URLWithString:number]]) {
                                                      ^~~~~~~
                                                      openURL:options:completionHandler:
    In module 'UIKit' imported from /Users/builder/clone/ios/Pods/Target Support Files/Flutter_phone_direct_caller/Flutter_phone_direct_caller-prefix.pch:2:
    /Applications/Xcode-12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:123:1: note: 'openURL:' has been explicitly marked deprecated here
    - (BOOL)openURL:(NSURL*)url API_DEPRECATED_WITH_REPLACEMENT("openURL:options:completionHandler:",10.0)) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    2 warnings generated.
    /Users/builder/programs/Flutter_2_0_3/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.13.6/ios/Classes/AudioplayersPlugin.m:77:33: warning: incompatible pointer types sending 'FlutterEngine *' to parameter of type 'NSObject<FlutterBinaryMessenger> * _Nonnull' [-Wincompatible-pointer-types]
                    binaryMessenger:_headlessEngine];
                                    ^~~~~~~~~~~~~~~
    In module 'Flutter' imported from /Users/builder/programs/Flutter_2_0_3/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.13.6/ios/Classes/AudioplayersPlugin.h:1:
    /Users/builder/programs/Flutter_2_0_3/bin/cache/artifacts/engine/ios-release/Flutter.xcframework/ios-armv7_arm64/Flutter.framework/Headers/FlutterChannels.h:178:74: note: passing argument to parameter 'messenger' here
                          binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger;
                                                                             ^
    /Users/builder/programs/Flutter_2_0_3/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.13.6/ios/Classes/AudioplayersPlugin.m:384:66: warning: 'initWithImage:' is deprecated: first deprecated in iOS 10.0 - Use -initWithBoundsSize:requestHandler: [-Wdeprecated-declarations]
          MPMediaItemArtwork *albumart = [[MPMediaItemArtwork alloc] initWithImage: artworkImage];
                                                                     ^
    In module 'MediaPlayer' imported from /Users/builder/programs/Flutter_2_0_3/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.13.6/ios/Classes/AudioplayersPlugin.m:4:
    /Applications/Xcode-12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItem.h:240:1: note: 'initWithImage:' has been explicitly marked deprecated here
    - (instancetype)initWithImage:(UIImage *)image MP_DEPRECATED("Use -initWithBoundsSize:requestHandler:",ios(5.0,10.0));
    ^
    /Users/builder/programs/Flutter_2_0_3/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.13.6/ios/Classes/AudioplayersPlugin.m:607:25: warning: 'seektotime:' is deprecated: first deprecated in iOS 11.0 - Use -seektotime:completionHandler:,passing nil for the completionHandler if you don't require notification of completion [-Wdeprecated-declarations]
      [[player currentItem] seektotime:time];
                            ^
    In module 'AVFoundation' imported from /Users/builder/programs/Flutter_2_0_3/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.13.6/ios/Classes/AudioplayersPlugin.m:5:
    /Applications/Xcode-12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVPlayerItem.h:809:1: note: 'seektotime:' has been explicitly marked deprecated here
    - (void)seektotime:(CMTime)time API_DEPRECATED("Use -seektotime:completionHandler:,passing nil for the completionHandler if you don't require notification of completion",macos(10.7,10.13),ios(4.0,11.0),11.0)) API_UNAVAILABLE(watchos);
    ^
    3 warnings generated.
    ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
    ld: warning: Could not find or use auto-linked library 'swiftCompatibility50'
    ld: warning: Could not find or use auto-linked library 'swiftCore'
    ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
    ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
    ld: warning: Could not find or use auto-linked library 'swiftDarwin'
    ld: warning: Could not find or use auto-linked library 'swiftUIKit'
    ld: warning: Could not find or use auto-linked library 'swiftFoundation'
    ld: warning: Could not find or use auto-linked library 'swiftCompatibility51'
    ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
    ld: warning: Could not find or use auto-linked library 'swiftCoreMedia'
    ld: warning: Could not find or use auto-linked library 'swiftdispatch'
    ld: warning: Could not find or use auto-linked library 'swiftMetal'
    ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
    ld: warning: Could not find or use auto-linked library 'swiftCor
eImage'
    ld: warning: Could not find or use auto-linked library 'swiftCoreAudio'
    Undefined symbols for architecture arm64:
      "__swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements",referenced from:
          __swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements_$_telephony)
      "__swift_FORCE_LOAD_$_swiftCompatibility51",referenced from:
          __swift_FORCE_LOAD_$_swiftCompatibility51_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibility51_$_telephony)
      "__swift_FORCE_LOAD_$_swiftCompatibility50",referenced from:
          __swift_FORCE_LOAD_$_swiftCompatibility50_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibility50_$_telephony)
      "__swift_FORCE_LOAD_$_swiftCoreAudio",referenced from:
          __swift_FORCE_LOAD_$_swiftCoreAudio_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreAudio_$_telephony)
      "type Metadata for Swift.String",referenced from:
          telephony.SwiftTelephonyPlugin.handle(_: __C.FlutterMethodCall,result: (Any?) -> ()) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
          function signature specialization <Arg[0] = Dead,Arg[1] = Dead,Arg[2] = Owned To Guaranteed> of function signature specialization <Arg[1] = [Closure Propagated : reabstraction thunk helper from @escaping @callee_uNowned @convention(block) (@uNowned Swift.Optional<Swift.AnyObject>) -> () to @escaping @callee_guaranteed (@in_guaranteed Swift.Optional<Any>) -> (),Argument Types : [@escaping @callee_uNowned @convention(block) (@uNowned Swift.AnyObject?) -> ()]> of telephony.SwiftTelephonyPlugin.handle(_: __C.FlutterMethodCall,result: (Any?) -> ()) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
      "_swift_bridgeObjectRelease",result: (Any?) -> ()) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
      "__swift_FORCE_LOAD_$_swiftCoreMedia",referenced from:
          __swift_FORCE_LOAD_$_swiftCoreMedia_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreMedia_$_telephony)
      "__swift_FORCE_LOAD_$_swiftCoreImage",referenced from:
          __swift_FORCE_LOAD_$_swiftCoreImage_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreImage_$_telephony)
      "__swift_FORCE_LOAD_$_swiftCoreGraphics",referenced from:
          __swift_FORCE_LOAD_$_swiftCoreGraphics_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreGraphics_$_telephony)
      "__swift_FORCE_LOAD_$_swiftQuartzCore",referenced from:
          __swift_FORCE_LOAD_$_swiftQuartzCore_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftQuartzCore_$_telephony)
      "_swift_release",referenced from:
          ___swift_destroy_Boxed_opaque_existential_0 in libtelephony.a(SwiftTelephonyPlugin.o)
      "__swift_FORCE_LOAD_$_swiftdispatch",referenced from:
          __swift_FORCE_LOAD_$_swiftdispatch_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftdispatch_$_telephony)
      "__swift_FORCE_LOAD_$_swiftCoreFoundation",referenced from:
          __swift_FORCE_LOAD_$_swiftCoreFoundation_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreFoundation_$_telephony)
      "_swift_getinitializedobjcclass",referenced from:
          static telephony.SwiftTelephonyPlugin.register(with: __C.FlutterPluginRegistrar) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
          type Metadata accessor for telephony.SwiftTelephonyPlugin in libtelephony.a(SwiftTelephonyPlugin.o)
          @objc static telephony.SwiftTelephonyPlugin.register(with: __C.FlutterPluginRegistrar) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
          telephony.SwiftTelephonyPlugin.handle(_: __C.FlutterMethodCall,result: (Any?) -> ()) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
      "__swift_FORCE_LOAD_$_swiftFoundation",referenced from:
          __swift_FORCE_LOAD_$_swiftFoundation_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftFoundation_$_telephony)
      "value witness table for Builtin.UnkNownObject",referenced from:
          full type Metadata for telephony.SwiftTelephonyPlugin in libtelephony.a(SwiftTelephonyPlugin.o)
      "(extension in Foundation):Swift.String._bridgetoObjectiveC() -> __C.Nsstring",referenced from:
          static telephony.SwiftTelephonyPlugin.register(with: __C.FlutterPluginRegistrar) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
          @objc static telephony.SwiftTelephonyPlugin.register(with: __C.FlutterPluginRegistrar) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
      "Swift._bridgeAnythingToObjectiveC(A) -> Swift.AnyObject",referenced from:
          function signature specialization <Arg[0] = Dead,result: (Any?) -> ()) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
      "_swift_getTypeByManglednameInContext",referenced from:
          ___swift_instantiateConcreteTypeFromMangledname in libtelephony.a(SwiftTelephonyPlugin.o)
      "__swift_FORCE_LOAD_$_swiftUIKit",referenced from:
          __swift_FORCE_LOAD_$_swiftUIKit_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftUIKit_$_telephony)
      "Swift.String.append(Swift.String) -> ()",result: (Any?) -> ()) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
      "__swift_FORCE_LOAD_$_swiftDarwin",referenced from:
          __swift_FORCE_LOAD_$_swiftDarwin_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftDarwin_$_telephony)
      "_swift_unkNownObjectRelease",referenced from:
          static telephony.SwiftTelephonyPlugin.register(with: __C.FlutterPluginRegistrar) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
          @objc static telephony.SwiftTelephonyPlugin.register(with: __C.FlutterPluginRegistrar) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
          function signature specialization <Arg[0] = Dead,result: (Any?) -> ()) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
      "static (extension in Foundation):Swift.String._unconditionallyBridgeFromObjectiveC(__C.Nsstring?) -> Swift.String",result: (Any?) -> ()) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
      "__swift_FORCE_LOAD_$_swiftMetal",referenced from:
          __swift_FORCE_LOAD_$_swiftMetal_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftMetal_$_telephony)
      "_swift_unkNownObjectRetain",referenced from:
          @objc static telephony.SwiftTelephonyPlugin.register(with: __C.FlutterPluginRegistrar) -> () in libtelephony.a(SwiftTelephonyPlugin.o)
      "__swift_FORCE_LOAD_$_swiftObjectiveC",referenced from:
          __swift_FORCE_LOAD_$_swiftObjectiveC_$_telephony in libtelephony.a(SwiftTelephonyPlugin.o)
         (maybe you meant: __swift_FORCE_LOAD_$_swiftObjectiveC_$_telephony)
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command Failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: Provisioning profile "com XXX ios_app_development xxxxxxx" for "Runner" contains entitlements that aren't in the entitlements file: com.apple.developer.devicecheck.appattest-environment. To use these entitlements,add them to your entitlements file. Otherwise,remove unused entitlements from your provisioning profile. (in target 'Runner' from project 'Runner')

Encountered error while archiveing for device.


Build Failed :|
Failed to build for iOS

解决方法

我认为你应该尝试在你的 xcode 项目中创建一个空文件,比如 BridgeHeader.swift,如果你手动创建这个文件,只需添加

import Foundation

如果这不起作用,请尝试确保您拥有开发人员工具/工具链

,

我删除了IOS文件夹 从简单示例中复制 IOS 并更新所有IOS权限

它开始工作但很快就失败了 我将记录器添加到 mongodb 图集以解决问题