无法为模拟器构建应用程序。在 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
/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 上启动应用程序时出错的主要内容,如果未能解决你的问题,请参考以下文章