I'm having an issue with my project. I get this bunch of Error on Build on Xcode (developing on Visual Studio Code).
Launching lib/main.dart on iPhone 11 Pro in debug mode...
Xcode build done. 1456.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/usuario/development/projects/stb/property1/ios/Pods/BSImagePicker/Sources/Scene/Albums/AlbumsViewController.swift:26:40: warning: using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead
protocol AlbumsViewControllerDelegate: class {
^~~~~
AnyObject
/Users/usuario/development/projects/stb/property1/ios/Pods/BSImagePicker/Sources/Scene/Assets/AssetsViewController.swift:26:40: warning: using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead
protocol AssetsViewControllerDelegate: class {
^~~~~
AnyObject
/Users/usuario/development/projects/stb/property1/ios/Pods/BSImagePicker/Sources/Controller/ImagePickerControllerDelegate.swift:27:48: warning: using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead
public protocol ImagePickerControllerDelegate: class {
^~~~~
AnyObject
/Users/usuario/development/projects/stb/property1/ios/Pods/BSImagePicker/Sources/Scene/Albums/AlbumsViewController.swift:26:40: warning: using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead
protocol AlbumsViewControllerDelegate: class {
^~~~~
AnyObject
/Users/usuario/development/projects/stb/property1/ios/Pods/BSImagePicker/Sources/Scene/Assets/AssetsViewController.swift:26:40: warning: using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead
protocol AssetsViewControllerDelegate: class {
^~~~~
AnyObject
/Users/usuario/development/projects/stb/property1/ios/Pods/BSImagePicker/Sources/Controller/ImagePickerControllerDelegate.swift:27:48: warning: using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead
public protocol ImagePickerControllerDelegate: class {
^~~~~
AnyObject
/Users/usuario/development/projects/stb/property1/ios/Pods/BSImagePicker/Sources/Scene/Albums/AlbumsViewController.swift:26:40: warning: using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead
protocol AlbumsViewControllerDelegate: class {
^~~~~
AnyObject
/Users/usuario/development/projects/stb/property1/ios/Pods/BSImagePicker/Sources/Scene/Assets/AssetsViewController.swift:26:40: warning: using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead
protocol AssetsViewControllerDelegate: class {
^~~~~
AnyObject
/Users/usuario/development/projects/stb/property1/ios/Pods/BSImagePicker/Sources/Controller/ImagePickerControllerDelegate.swift:27:48: warning: using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead
public protocol ImagePickerControllerDelegate: class {
^~~~~
AnyObject
/Users/usuario/development/projects/stb/property1/ios/Pods/AppAuth/Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m:148:42: warning: 'openURL:' is deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
[[UIApplication sharedApplication] openURL:_appStoreURL];
^~~~~~~
openURL:options:completionHandler:
In module 'UIKit' imported from /Users/usuario/development/projects/stb/property1/ios/Pods/Target Support Files/AppAuth/AppAuth-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.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("");
^
/Users/usuario/development/projects/stb/property1/ios/Pods/AppAuth/Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m:156:61: warning: 'openURL:' is deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
BOOL openedInBrowser = [[UIApplication sharedApplication] openURL:requestURL];
^~~~~~~
openURL:options:completionHandler:
In module 'UIKit' imported from /Users/usuario/development/projects/stb/property1/ios/Pods/Target Support Files/AppAuth/AppAuth-prefix.pch:2:
1 warning generated.
In file included from /Users/usuario/development/projects/stb/property1/ios/Pods/gRPC-Core/src/core/lib/security/transport/client_auth_filter.cc:32:
In file included from /Users/usuario/development/projects/stb/property1/ios/Pods/gRPC-Core/src/core/lib/security/context/security_context.h:28:
/Users/usuario/development/projects/stb/property1/ios/Pods/gRPC-Core/src/core/lib/security/credentials/credentials.h:205:15: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
typedef struct {
^
grpc_credentials_mdelem_array
/Users/usuario/development/projects/stb/property1/ios/Pods/gRPC-Core/src/core/lib/security/credentials/credentials.h:206:21: note: type is not C-compatible due to this default member initializer
grpc_mdelem* md = nullptr;
^~~~~~~
/Users/usuario/development/projects/stb/property1/ios/Pods/gRPC-Core/src/core/lib/security/credentials/credentials.h:208:3: note: type is given name 'grpc_credentials_mdelem_array' for linkage purposes by this typedef declaration
} grpc_credentials_mdelem_array;
^
1 warning generated.
In file included from /Users/usuario/development/projects/stb/property1/ios/Pods/gRPC-Core/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:36:
In file included from /Users/usuario/development/projects/stb/property1/ios/Pods/gRPC-Core/src/core/ext/transport/chttp2/transport/context_list.h:26:
/Users/usuario/development/projects/stb/property1/ios/Pods/gRPC-Core/src/core/ext/transport/chttp2/transport/internal.h:109:15: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
typedef struct {
^
grpc_chttp2_ping_queue
/Users/usuario/development/projects/stb/property1/ios/Pods/gRPC-Core/src/core/ext/transport/chttp2/transport/internal.h:110:52: note: type is not C-compatible due to this default member initializer
grpc_closure_list lists[GRPC_CHTTP2_PCL_COUNT] = {};
^
Failed to package /Users/usuario/development/projects/stb/property1.
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
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro.
Exited (sigterm)
This happened out of the blue with no issues until this morning. I had before an Issue with:
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
which I think it got Solved using:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
end
end
end
In the PodFile.
Then I still got this error, the one I'm consulting for, so I tried updating my Flutter from 2.2.0 to 2.5.0, and I updated my dependencies from:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
provider: ^5.0.0
intl: ^0.17.0
carousel_pro: ^1.0.0
url_launcher: ^6.0.3
photo_view: ^0.11.1
cloud_firestore: ^2.2.1
firebase_core: ^1.1.1
firebase_auth: ^1.1.4
image_picker: ^0.7.5
firebase_storage: ^8.0.6
random_string: ^2.1.0
algolia: ^1.0.1
custom_switch: ^0.0.1
material_design_icons_flutter: ^4.0.5955
google_sign_in: ^5.0.4
firebase_dynamic_links: ^2.0.4
share: ^2.0.2
flutter_facebook_login: ^3.0.0
http: ^0.13.3
sign_in_with_apple: ^3.0.0
csc_picker: ^0.2.5
us_states: ^1.1.0
multi_image_picker2: ^5.0.2
percent_indicator: ^3.0.1
flutter_material_pickers: ^3.1.0 #used on Selling Bathrooms and Bedrooms
numberpicker: ^2.1.1 #used on Selling Bedrooms only.
eva_icons_flutter: ^3.0.0
badges: ^2.0.1
flutter_xlider: ^3.4.0
expandable_text: 2.2.0
google_maps_flutter: ^2.0.6
line_icons: ^2.0.1
intl_phone_field: ^2.0.1 #used to get the phone in the Profile Page.
flutter_masked_text: ^0.8.0 #used to do the mask of the Filters TextFormField to Dollar Value, not use currently
flutter_absolute_path: ^1.0.6 #used to get the file path for multi Image
rxdart: ^0.27.2 #used for Geolocation queries with Firebase
geoflutterfire: ^3.0.1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
firebase_messaging: ^10.0.6
To:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
provider: ^6.0.0
intl: ^0.17.0
carousel_pro: ^1.0.0
url_launcher: ^6.0.10
photo_view: ^0.12.0
cloud_firestore: ^2.5.3
firebase_core: ^1.6.0
firebase_auth: ^3.1.1
image_picker: ^0.8.4 1
firebase_storage: ^10.0.3
random_string: ^2.3.1
algolia: ^1.0.1
custom_switch: ^0.0.1
material_design_icons_flutter: ^4.0.5955
google_sign_in: ^5.1.0
firebase_dynamic_links: ^2.0.9
share: ^2.0.4
#flutter_facebook_login: ^3.0.0
http: ^0.13.3
sign_in_with_apple: ^3.0.0
csc_picker: ^0.2.5
us_states: ^1.1.5
multi_image_picker2: ^5.0.2
percent_indicator: ^3.0.1
flutter_material_pickers: ^3.1.0 #used on Selling Bathrooms and Bedrooms
numberpicker: ^2.1.1 #used on Selling Bedrooms only.
eva_icons_flutter: ^3.0.2
badges: ^2.0.1
flutter_xlider: ^3.4.0
expandable_text: ^2.2.0
google_maps_flutter: ^2.0.9
line_icons: ^2.0.1
intl_phone_field: ^2.1.0 #used to get the phone in the Profile Page.
flutter_masked_text: ^0.8.0 #used to do the mask of the Filters TextFormField to Dollar Value, not use currently
#flutter_absolute_path: ^1.0.6 #used to get the file path for multi Image
rxdart: ^0.27.2 #used for Geolocation queries with Firebase
geoflutterfire: ^3.0.1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
firebase_messaging: ^10.0.7
Obviously, updating my code to reflect the changes, any ideas on how to get it back in the iOS simulator and working back to normal?
CodePudding user response:
If any one faces this issue, I manage a Fix, first here I was facing 2 Issues:
The Pods of my Projects weren't working anymore due to the support drop for iOS 8 in Xcode 12 (More info in Link).
In my efforts to make it work I updated from Flutter 2.2.0 to 2.5.0 which basically makes a lot of changes and takes support away from some methods, which Dependencies rely on.
To fix this I did 2 things:
Starting with issue 2, I just made a downgrade to my Flutter by ussing the command flutter downgrade 2.2.0 this help me get back to my original issue without facing the Methods taken away of those dependecies.
As for Issue 1 there were to things:
First added this into the PodFile:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
Secondly to fix the Pods I did the following steps:
- Delete the pubspec.lock file.
- In terminal of the main Project
- Did a Flutter Clean.
- In terminal going to the iOS Folder:
- Delete the Podfile.lock
- Delete the Pods Folder.
- CRUCIAL: Copy (where ever as a backup) the Content of the PodFile including the part added at the end.
- Delete the Podfile.
- In Terminal in iOS Folder do a pod init. (This will Generate the Podfile with basic info).
- In Terminal in iOS Folder do a pod install. (This will Generate the Podfile.lock and the Pods folder with basic info).
- Navigate to the main Project folder in Terminal (cd ..) or use the Pub get icon in the pubspec.yaml file.
- Do a flutter pub get
- In terminal going to the iOS Folder:
- Do a pod install.
- Navigate to the main Project folder in Terminal (cd ..)
Finally, just do a flutter run.
This was how I manage to solve it.
Kind Regards