Issue
I have recently updated multiple components of my system and since then flutter iOS builds don't work anymore.
My plan was to identify the libraries that cause the problems I decided to start with a clean new project and add my required libraries one by one until it fails. The problem is that I cannot even launch a freshly created Android Studio "new flutter project" on the iOs Simulator (or on a real IPhone for that matter).
I have added signing in Xcode 13.2.1 - no further changes.
My system runs on macOS Monterey 12.2.1.
When I try to launch this "virgin" app the Output is:
Launching lib/main.dart on iPhone 13 in debug mode...
Running Xcode build...
Xcode build done. 2.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/t1/l4k0xxn13vz_ngc05nvytsb40000gn/T/flutter_tools.Gg1WCD/flutter_ios_build_temp_dirCeOcFZ/temporary_xcresult_bundle
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:109:12: error: attributes may not be specified on a category
@interface NSArray<ObjectType> (NSArrayDiffing)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:196:12: error: attributes may not be specified on a category
@interface NSMutableArray<ObjectType> (NSMutableArrayDiffing)
^
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:12:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:91:143: error: function does not return NSString
- (NSAttributedString *)localizedAttributedStringForKey:(NSString *)key value:(nullable NSString *)value table:(nullable NSString *)tableName NS_FORMAT_ARGUMENT(1) NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
~~~~~~~~~~~~~~ ^ ~
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:103:48: note: expanded from macro 'NS_FORMAT_ARGUMENT'
#define NS_FORMAT_ARGUMENT(A) __attribute__ ((format_arg(A)))
^ ~
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:49:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSKeyValueCoding.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSOrderedSet.h:112:12: error: attributes may not be specified on a category
@interface NSOrderedSet<ObjectType> (NSOrderedSetDiffing)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSOrderedSet.h:185:12: error: attributes may not be specified on a category
@interface NSMutableOrderedSet<ObjectType> (NSMutableOrderedSetDiffing)
^
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:56:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSMorphology.h:64:12: error: attributes may not be specified on a category
@interface NSMorphology (NSCustomPronouns)
^
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:130:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:500:168: error: expected ')'
- (void)readDataOfMinLength:(NSUInteger)minBytes maxLength:(NSUInteger)maxBytes timeout:(NSTimeInterval)timeout completionHandler:(void (^) (NSData * _Nullable_result data, BOOL atEOF, NSError * _Nullable error))completionHandler;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:500:141: note: to match this '('
- (void)readDataOfMinLength:(NSUInteger)minBytes maxLength:(NSUInteger)maxBytes timeout:(NSTimeInterval)timeout completionHandler:(void (^) (NSData * _Nullable_result data, BOOL atEOF, NSError * _Nullable error))completionHandler;
^
7 errors generated.
/Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:9: fatal error: could not build module 'Foundation'
#import <Foundation/Foundation.h>
~~~~~~~^
8 errors generated.
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/t1/l4k0xxn13vz_ngc05nvytsb40000gn/T/flutter_tools.Gg1WCD/flutter_ios_build_temp_dirCeOcFZ/temporary_xcresult_bundle
Parse Issue (Xcode): Attributes may not be specified on a category
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:108:11
Parse Issue (Xcode): Attributes may not be specified on a category
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:195:11
Semantic Issue (Xcode): Function does not return NSString
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:90:142
Parse Issue (Xcode): Attributes may not be specified on a category
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSOrderedSet.h:111:11
Parse Issue (Xcode): Attributes may not be specified on a category
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSOrderedSet.h:184:11
Parse Issue (Xcode): Attributes may not be specified on a category
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSMorphology.h:63:11
Parse Issue (Xcode): Expected ')'
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:499:167
Parse Issue (Xcode): Could not build module 'Foundation'
/Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target%20Support%20Files/Pods-Runner/Pods-Runner-dummy.m:0:8
Could not build the application for the simulator.
Error launching application on iPhone 13.
flutter doctor -v returns:
[✓] Flutter (Channel stable, 2.10.1, on macOS 12.2.1 21D62 darwin-x64, locale en-AT)
• Flutter version 2.10.1 at /Users/bernhardpiskernik/Library/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision db747aa133 (5 days ago), 2022-02-09 13:57:35 -0600
• Engine revision ab46186b24
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /Users/bernhardpiskernik/Library/Android/sdk/
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] Connected device (2 available)
• iPhone 13 (mobile) • 32762AE5-1FA2-428D-98DD-998153C83A7E • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
What am I missing?
Solution
Turns out, I have updated something in my conda base environment that caused the issue.
A conda deactivate
was sufficient to successfully run flutter
.
To make the run button work again I had to disable the automatic start of the conda base environment by adding conda config --set auto_activate_base false
after the conda init block in .zshrc and restarting the MacBook.
Answered By - Bernhard Piskernik
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.