使用 Codemagic 在没有 Mac 的情况下构建到 iOS

Building to iOS without Mac using Codemagic

我目前想将我的 Flutter 应用程序部署到 Apple 的 App Store,但遗憾的是我没有 Mac,因为它对我来说太贵了。不过,我在这里找到了一个解决方法,并尝试使用 Codemagic 构建应用程序并将其部署到 AppStore。但是,在尝试在 Codemagic 中为 iOS 构建时,我收到了错误消息:

== Building for iOS ==


== /usr/local/bin/flutter build ios --debug --no-codesign ==

/Users/builder/clone/ios/Runner/Info.plist: Property List error: Found non-key inside <dict> at line 7 / JSON error: JSON text did not start with array or object and option to allow fragments not set.
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.example.syncshopWebview for device (ios)...

Running pod install...                                          
    4.8s

Running Xcode build...                                          

Xcode build done.                                           60.5s


Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/builder/programs/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webview_plugin-0.3.9+1/ios/Classes/FlutterWebviewPlugin.m:91:22: warning: incompatible pointer to integer conversion assigning to 'BOOL' (aka 'signed char') from 'id _Nullable' [-Wint-conversion]
        _enableAppScheme = call.arguments[@"enableAppScheme"];
                         ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/builder/programs/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webview_plugin-0.3.9+1/ios/Classes/FlutterWebviewPlugin.m:418:98: warning: values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Wformat]
        [channel invokeMethod:@"onHttpError" arguments:@{@"code": [NSString stringWithFormat:@"%ld", error.code], @"url": url}];
                                                                                               ~~~   ^~~~~~~~~~
                                                                                               %ld   (long)
    /Users/builder/programs/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webview_plugin-0.3.9+1/ios/Classes/FlutterWebviewPlugin.m:426:98: warning: values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Wformat]
        [channel invokeMethod:@"onHttpError" arguments:@{@"code": [NSString stringWithFormat:@"%ld", error.code], @"error": error.localizedDescription}];
                                                                                               ~~~   ^~~~~~~~~~
                                                                                               %ld   (long)
    /Users/builder/programs/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webview_plugin-0.3.9+1/ios/Classes/FlutterWebviewPlugin.m:434:106: warning: values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead [-Wformat]
                [channel invokeMethod:@"onHttpError" arguments:@{@"code": [NSString stringWithFormat:@"%ld", response.statusCode], @"url": webView.URL.absoluteString}];
                                                                                                       ~~~   ^~~~~~~~~~~~~~~~~~~
                                                                                                       %ld   (long)
    4 warnings generated.
    2020-01-01 17:20:28.170 ibtoold[1414:18701] DEBUG: Added to environment: {
        TMPDIR = "/var/folders/r7/d9twdq011sb8d3q1p8f39cdr0000gn/T/763735EC-50B9-405B-83C2-E28A2CD2AD2C";
    }
    /* com.apple.actool.document.warnings */
    /Users/builder/clone/ios/Runner/Assets.xcassets:./AppIcon.appiconset: warning: A 76x76@1x app icon is required for iPad apps targeting iOS 7, 8, and 9
    /Users/builder/clone/ios/Runner/Assets.xcassets:./AppIcon.appiconset: warning: A 76x76@2x app icon is required for iPad apps targeting iOS 7.0 and later
    /Users/builder/clone/ios/Runner/Assets.xcassets:./AppIcon.appiconset: warning: A 83.5x83.5@2x app icon is required for iPad apps targeting iOS 9.0 and later
    /* com.apple.actool.document.notices */
    /Users/builder/clone/ios/Runner/Assets.xcassets:./AppIcon.appiconset/[][iphone][57x57][][][1x][][]: notice: 57x57 app icons only apply to iPhone apps targeting releases of iOS prior to 7.0
    /Users/builder/clone/ios/Runner/Assets.xcassets:./AppIcon.appiconset/[][iphone][57x57][][][2x][][]: notice: 57x57@2x app icons only apply to iPhone apps targeting releases of iOS prior to 7.0
    /* com.apple.actool.compilation-results */
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon20x20@2x.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon20x20@3x.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon29x29.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon29x29@2x.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon29x29@3x.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon40x40@2x.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon40x40@3x.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon57x57.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon57x57@2x.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon60x60@2x.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/AppIcon60x60@3x.png
    /Users/builder/clone/build/ios/Debug-iphoneos/Runner.app/Assets.car
    /Users/builder/Library/Developer/Xcode/DerivedData/Runner-edaimyiflreloheqntgnhkmwcclv/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/assetcatalog_generated_info.plist

    error: unable to read property list from file: /Users/builder/clone/ios/Runner/Info.plist: The operation couldn’t be completed. (XCBUtil.PropertyListConversionError error 1.) (in target 'Runner' from project 'Runner')
    note: Using new build system
    note: Planning build
    note: Constructing build description

════════════════════════════════════════════════════════════════════════════════
Building a deployable iOS app requires a selected Development Team with a 
Provisioning Profile. Please ensure that a Development Team is selected by:
  1- Open the Flutter project's Xcode target with
       open ios/Runner.xcworkspace
  2- Select the 'Runner' project in the navigator then the 'Runner' target
     in the project settings
  3- In the 'General' tab, make sure a 'Development Team' is selected. 
     You may need to:
         - Log in with your Apple ID in Xcode first
         - Ensure you have a valid unique Bundle ID
         - Register your device with your Apple Developer Account
         - Let Xcode automatically provision a profile for your app
  4- Build or run your project again

For more information, please visit:
  https://flutter.dev/setup/#deploy-to-ios-devices

Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
Encountered error while building for device.



Build failed :|
Failed to build for iOS

请耐心等待,我无法完全遵循有关将 Flutter 应用程序部署到 AppStore 的文档,因为我没有 Mac。

非常感谢!

如果您正在寻找我的 info.plist 中的内容,它是:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <key>io.flutter.embedded_views_preview</key>
    <true/>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>SyncShop</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(FLUTTER_BUILD_NAME)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>
</plist>

您的 info.plist 开头无效,应该如下所示:

    <key>io.flutter.embedded_views_preview</key>
    <true/>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>

您可以看到 io.flutter.embedded_views_preview 已粘贴在现有 CFBundleDevelopmentRegion 及其值之间。