Запуск приложения Flutter в iOS с Android Studio / Visual Code - PullRequest
1 голос
/ 21 января 2020

Я новичок для флаттера. Мое простое приложение, работающее на устройстве Android без каких-либо проблем, а также на устройстве iOS, когда я запускаю его из Xcode, но при попытке запустить на устройстве iOS из Android Studio или Visual Code оно показывает следующие ошибки

Launching lib/main.dart on Shafraz Buhary’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 836SQ257Z6
Running Xcode build...
Xcode build done.                                            6.1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    In file included from <module-includes>:1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.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/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.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 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    In file included from <module-includes>:1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:48:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSKeyValueCoding.h:8:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.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/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSOrderedSet.h:187:12: error: attributes may not be specified on a category
    @interface NSMutableOrderedSet<ObjectType> (NSMutableOrderedSetDiffing)
               ^
    4 errors generated.
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    In file included from <module-includes>:1:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:9: fatal error: could not build module 'Foundation'
    #import <Foundation/Foundation.h>
     ~~~~~~~^
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    While building module 'QuartzCore' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:10:
    In file included from <module-includes>:1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h:9:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CoreAnimation.h:10:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CATransform3D.h:12:9: fatal error: could not build module 'Foundation'
    #import <Foundation/NSValue.h>
     ~~~~~~~^
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    While building module 'QuartzCore' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:10:
    While building module 'OpenGLES' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAEAGLLayer.h:7:
    In file included from <module-includes>:1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGLDrawable.h:8:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGL.h:8:10: fatal error: could not build module 'Foundation'
    #include <Foundation/Foundation.h>
     ~~~~~~~~^
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    While building module 'QuartzCore' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:10:
    While building module 'OpenGLES' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAEAGLLayer.h:7:
    While building module 'IOSurface' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGLIOSurface.h:13:
    In file included from <module-includes>:3:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h:15:9: fatal error: could not build module 'Foundation'
    #import <Foundation/Foundation.h>
     ~~~~~~~^
    1 error generated.
    2 errors generated.
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    While building module 'QuartzCore' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:10:
    While building module 'Metal' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAMetalLayer.h:7:
    In file included from <module-includes>:1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.h:9:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLTypes.h:8:9: fatal error: could not build module 'Foundation'
    #import <Foundation/Foundation.h>
     ~~~~~~~^
    1 error generated.
    4 errors generated.
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    While building module 'CoreImage' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIColor.h:13:
    In file included from <module-includes>:1:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.h:9:9: fatal error: could not build module 'Foundation'
    #import <Foundation/Foundation.h>
     ~~~~~~~^
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    While building module 'CoreImage' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIColor.h:13:
    While building module 'CoreVideo' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:10:
    In file included from <module-includes>:1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:29:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:462:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBufferIOSurface.h:26:10: fatal error: could not build module 'IOSurface'
    #include <IOSurface/IOSurfaceRef.h>
     ~~~~~~~~^
    1 error generated.
    2 errors generated.
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    While building module 'FileProvider' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/NSFileProviderExtension.h:15:
    In file included from <module-includes>:1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/FileProvider.framework/Headers/FileProvider.h:15:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h:8:9: fatal error: could not build module 'Foundation'
    #import <Foundation/Foundation.h>
     ~~~~~~~^
    1 error generated.
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'UIKit' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:
    While building module 'UserNotifications' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UNNotificationResponse+UIKitAdditions.h:10:
    In file included from <module-includes>:1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.h:8:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/NSString+UserNotifications.h:8:9: fatal error: could not build module 'Foundation'
    #import <Foundation/Foundation.h>
     ~~~~~~~^
    1 error generated.
    13 errors generated.
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    In file included from <module-includes>:1:
    In file included from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/Flutter.h:54:
    /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:8:9: fatal error: could not build module 'UIKit'
    #import <UIKit/UIKit.h>
     ~~~~~~~^
    While building module 'Flutter' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:
    While building module 'CoreMedia' imported from /Volumes/Data/RnD/flutter/flutter_book/ios/Flutter/Flutter.framework/Headers/FlutterTexture.h:8:
    In file included from <module-includes>:1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.h:15:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CMFormatDescription.h:29:10: fatal error: could not build module 'CoreVideo'
    #include <CoreVideo/CoreVideo.h>
     ~~~~~~~~^
    1 error generated.
    15 errors generated.
    In file included from /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.m:5:
    /Volumes/Data/RnD/flutter/flutter_book/ios/Runner/GeneratedPluginRegistrant.h:8:9: fatal error: could not build module 'Flutter'
    #import <Flutter/Flutter.h>
     ~~~~~~~^
    16 errors generated.
    note: Using new build system
    note: Planning build
    note: Constructing build description

Could not build the precompiled application for the device.

Error launching application on Shafraz Buhary’s iPhone.

Когда я запускаю flutter doctor -v , он показывает, что все в порядке

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-LK)
    • Flutter version 1.12.13+hotfix.5 at /Library/Frameworks/flutter
    • Framework revision 27321ebbad (6 weeks ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Library/Frameworks/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 40.2.4
    • Dart plugin version 192.6817.14

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] VS Code (version 1.41.1)
    • VS Code at /Users/shafraz/Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (1 available)
    • Shafraz Buhary’s iPhone • bb37XXXXXXc167be5XXXXXX48d70136c2XXXXXX • ios • iOS 13.3

• No issues found!

Как я могу это исправить?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...