Flutter iOS App 上架 使用 Flutter 框架搭建的App上架那些事(持续更新)

前言

今天是第一个 Flutter iOS App 上架,激动,还有点担心。问题还不少,总结一下,让大家少入坑。

问题集锦

问题一:
ERROR ITMS-90189: "Redundant Binary Upload. You've already uploaded a build with build number '1' for 
version number '1.0'. Make sure you increment the build string before you upload your app to App Store 
Connect. Learn more in Xcode Help (http://help.apple.com/xcode/mac/current/#/devba7f53ad4)."

Flutter iOS App 上架 使用 Flutter 框架搭建的App上架那些事(持续更新)_第1张图片
之前构建过 build 1,再次构建上传就会报此错误,苹果默认是不允许在同一个版本号下构建同一个构建版本的。

解决办法:
更改 version 号或者更改 build 号即可。
Flutter iOS App 上架 使用 Flutter 框架搭建的App上架那些事(持续更新)_第2张图片

问题二:
ITMS-90683: Missing Purpose String in Info.plist - Your app's code references one or more APIs that access 
sensitive user data. The app's Info.plist file should contain a NSLocationAlwaysUsageDescription key with a 
user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 
2019, all apps submitted to the App Store that access user data are required to include a purpose string. If 
you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app 
might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK 
and request they release a version of their code that doesn't contain the APIs. Learn more 
(https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to App Store Connect.

解决办法:

添加缺少的 key 和描述就可以。

NSVideoSubscriberAccountUsageDescription
    
    NSBluetoothPeripheralUsageDescription
    蓝牙权限
    NSSpeechRecognitionUsageDescription
    语音识别权限
    NSSiriUsageDescription
    Siri权限
    NSRemindersUsageDescription
    
    NSPhotoLibraryUsageDescription
    相册权限
    kTCCServiceMediaLibrary
    
    NSMotionUsageDescription
    运动权限
    NSMicrophoneUsageDescription
    麦克风权限
    NSAppleMusicUsageDescription
    音乐权限
    NSLocationWhenInUseUsageDescription
    地理位置权限
    NSLocationUsageDescription
    地理位置权限
    NSLocationAlwaysUsageDescription
    地理位置权限
    NSHomeKitUsageDescription
    
    NSHealthUpdateUsageDescription
    健康权限
    NSHealthShareUsageDescription
    健康权限
    NSContactsUsageDescription
    通讯录权限
    NSCameraUsageDescription
    摄像头权限
    NSCalendarsUsageDescription
    日历权限
问题三:

ERROR ITMS-90535错误:
Flutter iOS App 上架 使用 Flutter 框架搭建的App上架那些事(持续更新)_第3张图片
分析
“This action could not be completed. Try again”报错是苹果服务器的原因, 再试一次就好了。我是重复了2次就好了,换了时间段重新上传的就成功了

“ERROR ITMS-90535”根据报错的信息是EaseUIResource.Bundle文件出错

解决办法:

找到相应的 bundle 包,打开plist文件,删除 CFBundleExecutable 即可 CFBundleExecutable 在 info.plist 文件中显示为 Executable file
Flutter iOS App 上架 使用 Flutter 框架搭建的App上架那些事(持续更新)_第4张图片

问题四:
ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use 
WKWebView for improved security and reliability. Learn more 
(https://developer.apple.com/documentation/uikit/uiwebview).

解决办法:
将项目中 UIWebView 全部换成 WKWebView 即可。

问题五:

上架 广告标识符 设置

没有的话,选择否。

如果有分享功能,要选择是。
Flutter iOS App 上架 使用 Flutter 框架搭建的App上架那些事(持续更新)_第5张图片

问题六:

Flutter 打包 iOS,先在项目目录下运行:

flutter build ios --release

再到xcode下进行打包

如果不进行build命令,则在xcode下会报错:

flutter Could not find an option named "track-widget-creation".
问题七:

Flutter 命令行编译报错:

Block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior

解决办法:

Podfile 文件添加如下代码

inhibit_all_warnings!
问题八:

flutter 编译报错

No such file or directory   Command: /usr/local/bin/pod install --verbose

解决办法:

上述问题是升级了Mac系统导致的,当升级了新的系统后,别忘记更新cocoapods。执行命令为:

$ sudo gem update --system
$ sudo gem install cocoapods -n/usr/local/bin
问题九:

报错:

DTDeviceKit: deviceType from  was NUll

解决办法:

删除项目中的 build 文件夹,然后重新编译。

问题十:

报错:

Building for iOS, but the linked and embedded framework 'App.framework'

解决办法:

首先Clean下项目,在项目根目录下:

flutter clean

然后删除ios/Flutter/App.framework:

rm -rf ios/Flutter/App.framework

你可能感兴趣的:(Flutter学习实践指南,OC篇)