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

标签 android ios xcode flutter flutter-test

我目前想将我的 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

请耐心等待,因为我没有 Mac,所以我无法完全按照有关将 Flutter 应用程序部署到 AppStore 的文档进行操作。

非常感谢!

如果你正在寻找我的 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 及其值之间。

关于android - 使用 Codemagic 在没有 Mac 的情况下构建到 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59557453/

相关文章:

android - Inflater inflate 但高度很小(看起来像 wrap_content 需要 fill_parent)

ios - 禁用 FScalendar swift 中的一些 future 日期选择

php - iOS - 用于自动更新的存折注册网址

iphone - Xcode 4.6 构建、运行并立即完成(模拟器 iOS 6.1)

iphone - 匹配字典数组 - 其中一个数组不完全等于另一个数组

android - 什么是用于 eclipse android 开发的好的、免费的源代码控制系统?

android - ActivityCompat 错误(无法解析符号)

java - android loadIcon 产生 outOfMemoryError

ios - Xcode 初学者功能不会显示

iphone - 我正在尝试将 UIActivityIndi​​catorView 置于 UITableView 的中心,但它具有最高边距