无法为模拟器构建应用程序。在 iPhone 12 上启动应用程序时出错

Posted

技术标签:

【中文标题】无法为模拟器构建应用程序。在 iPhone 12 上启动应用程序时出错【英文标题】:Could not build the application for the simulator. Error launching application on iPhone 12 【发布时间】:2021-09-19 08:14:17 【问题描述】:

Xcode 构建的错误输出: ↳ ** 构建失败 **

Xcode 的输出: ↳ 生成 2 个警告。 /Users/hongziqing/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/ios/Classes/FLTI magePickerPlugin.m:149:20: 警告: 'UIAlertView' 已弃用: 首先在 iOS 9.0 中弃用 - UIAlertView 已弃用。改用 UIAlertController 和 UIAlertControllerStyleAlert 的preferredStyle [-Wdeprecated-declarations] [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) ^ 在从导入的模块“UIKit”中 /Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P ods/目标支持文件/image_picker/image_picker-prefix.pch:2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulat or14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12:注意:'UIAlertView'有 已在此处明确标记为已弃用 @interface UIAlertView : UIView ^ 生成 1 个警告。 /Users/hongziqing/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/ios/Classes/FLTI magePickerPhotoAssetUtil.m:17:44:警告:不推荐使用“UIImagePickerControllerReferenceURL”:首先 在 iOS 11.0 中已弃用 - 将在未来的版本中删除,请使用 phpicker。 [-Wdeprecated-declarations] NSURL *referenceURL = [info objectForKey:UIImagePickerControllerReferenceURL]; ^ 在从导入的模块“UIKit”中 /Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P ods/目标支持文件/image_picker/image_picker-prefix.pch:2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulat or14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIImagePickerController.h:62:51:注意: 'UIImagePickerControllerReferenceURL' 已在此处明确标记为已弃用 UIKIT_EXTERN UIImagePickerControllerInfoKey const UIImagePickerControllerReferenceURL API_DEPRECATED("将 在未来的版本中被删除,使用 PHPicker。", ios(4.1, 11.0)) API_UNAVAILABLE(tvos); // 一个 NSURL 引用 AssetsLibrary 框架中的资产 ^ /Users/hongziqing/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/ios/Classes/FLTI magePickerPhotoAssetUtil.m:21:47: 警告: 'fetchAssetsWithALAssetURLs:options:' 已弃用: 首先 在 iOS 11 中已弃用 - 将在未来版本中删除 [-Wdeprecated-declarations] PHFetchResult *result = [PHAsset fetchAssetsWithALAssetURLs:@[referenceURL] ^ 在从导入的模块“照片”中 /Users/hongziqing/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/ios/Classes/FLTI magePickerPhotoAssetUtil.h:6: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulat or14.5.sdk/System/Library/Frameworks/Photos.framework/Headers/PHAsset.h:74:1:注意: 'fetchAssetsWithALAssetURLs:options:' 已在此处明确标记为弃用 + (PHFetchResult *)fetchAssetsWithALAssetURLs:(NSArray)assetURLs 选项:(可为空 PHFetchOptions )options API_DEPRECATED("将在未来的版本中删除", ios(8, 11), tvos(8, 11)) API_UNAVAILABLE(macos); ^ 生成 2 个警告。 /Users/hongziqing/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-7.0.3/ios/Classes/Geoloc atorPlugin.m:199:11: 警告: 'openURL:' 已弃用: 首先在 iOS 10.0 中弃用 [-Wdeprecated-declarations] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; ^~~~~~~ openURL:选项:completionHandler: 在从导入的模块“UIKit”中 /Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P ods/目标支持文件/geolocator/geolocator-prefix.pch:2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulat or14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:123:1:注意:'openURL:'有 已在此处明确标记为已弃用 - (BOOL)openURL:(NSURL)url API_DEPRECATED_WITH_REPLACEMENT("openURL:options:completionHandler:", ios(2.0, 10.0)) NS_EXTENSION_UNAVAILABLE_IOS(""); ^ 生成 1 个警告。 /Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P ods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/AppEvents/FBSDKAppEvents.m:463:48:警告:转换为更小 来自'id _Nullable'的整数类型'BOOL'(又名'signed char')[-Wpointer-to-int-cast] isImplicitlyLogged:(BOOL) 参数[FBSDKAppEventParameterImplicitlyLogged] ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ 生成 1 个警告。 2021-07-09 05:19:21.827 ibtoold[20060:1048314] 调试:添加到环境: TMPDIR = "/var/folders/g3/5c3p3dks7j98vrqf5drj5tb00000gn/T/A091F85B-23E9-46EF-8E4B-4A482DCD63E5"; / com.apple.actool.document.warnings / /Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/R unner/Assets.xcassets:./AppIcon.appiconset/(null)[2d][Icon-App-50x50@1x.png]: 警告:应用图标集 “AppIcon”有 6 个未分配的孩子。 /Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/R unner/Assets.xcassets:./AppIcon.appiconset/(null)[2d][Icon-App-50x50@1x.png]: 警告:应用图标集 “AppIcon”有 6 个未分配的孩子。 / com.apple.actool.document.notices / /Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/R unner/Assets.xcassets:./AppIcon.appiconset/[][ipad][76x76][][][1x][][]:注意:仅 76x76@1x 应用程序图标 适用于针对 10.0 之前的 iOS 版本的 iPad 应用程序。 / com.apple.actool.compilation-results */ /Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/build /ios/Debug-iphonesimulator/Runner.app/AppIcon60x60@2x.png /Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/build /ios/Debug-iphonesimulator/Runner.app/AppIcon76x76@2x~ipad.png /Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/build /ios/Debug-iphonesimulator/Runner.app/Assets.car /Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Intermedia tes.noindex/Runner.build/Debug-iphonesimulator/Runner.build/assetcatalog_generated_info.plist

/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Intermedia
tes.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-F061639FB3B01BBD0F33B92D.sh: line 2:
/Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P
ods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh: Permission denied
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/uni_links/uni_links.framework'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/sqflite/sqflite.framework'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/shared_preferences/shared_preferences.framework'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/location/location.framework'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/image_cropper/image_cropper.framework'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/image_picker/image_picker.framework'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/url_launcher/url_launcher.framework'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/flutter_facebook_login/flutter_facebook_login.framework'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/Runner.app'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/Pods_Runner.framework'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/google_maps_flutter/google_maps_flutter.framework'

note: Removed stale file
'/Users/hongziqing/Library/Developer/Xcode/DerivedData/Runner-gmsrxwgtttvwtneuagslajhemjwt/Build/Products/
Debug-iphonesimulator/geolocator/geolocator.framework'

/Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P
ods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to
8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target
'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
/Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P
ods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to
8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target
'TOCropViewController' from project 'Pods')
/Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P
ods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to
8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FMDB' from
project 'Pods')
/Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P
ods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to
8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FBSDKLoginKit'
from project 'Pods')
/Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P
ods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to
8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FBSDKCoreKit'
from project 'Pods')
/Users/hongziqing/Desktop/APP_code/Development-Of-Auxiliary-Software-For-Medical-Scooter/Flutter_app/ios/P
ods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to
8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Flutter' from
project 'Pods')

无法为模拟器构建应用程序。 在 iPhone 12 上启动应用程序时出错。

【问题讨论】:

【参考方案1】:

错误提示您的 iOS 部署目标不受支持(很可能是由于依赖项需要更高的 iOS 版本)

您需要将最低 iOS 部署目标设置为版本 XX.xx

在位于 [YOUR-APP-DIRECTORY]/ios/Podfile 的 Podfile 文件的顶部更改/添加这一行

# Uncomment this line to define a global platform for your project
platform :ios, '11.0'

【讨论】:

以上是关于无法为模拟器构建应用程序。在 iPhone 12 上启动应用程序时出错的主要内容,如果未能解决你的问题,请参考以下文章

为 iPhone 设备构建应用程序时无法验证应用程序错误

为 iPhone 应用程序构建滚动视图页面

项目不是为 iphone 模拟器构建的。

iOS - 拒绝代码签名权限,现在无法构建

无法在 Xcode 的 iphone 模拟器中输入密码来创建帐户

Xcode:“构建并运行”而不重新启动 iPhone 模拟器