Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter 开发中的问题汇总 #34

Open
wangjing013 opened this issue Jun 8, 2021 · 0 comments
Open

Flutter 开发中的问题汇总 #34

wangjing013 opened this issue Jun 8, 2021 · 0 comments

Comments

@wangjing013
Copy link
Owner

1 开发者账号

2 Xcode

这应该是苹果上线最基本的保障, 那么在上线过程中遇到一些问题汇总一下:

问题一: 这是提交到 App connect 中时,反馈回来邮件

Dear Developer,

We identified one or more issues with a recent delivery for your app, "***-生活特权平台" 1.0 (1). Please correct the following issues, then upload again.

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 NSPhotoLibraryUsageDescription 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).

Though you are not required to fix the following issues, we wanted to make you aware of them:

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).

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 NSLocationWhenInUseUsageDescription 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).

主要是一些访问权限的问题,需要在 info.plist 中添加一下,以及添加配置. 常见的添加内容如下

<!-- 相册 --> 
<key>NSPhotoLibraryUsageDescription</key> 
<string>App需要您的同意,才能访问相册</string> 
<!-- 相机 --> 
<key>NSCameraUsageDescription</key> 
<string>App需要您的同意,才能访问相机</string> 
<!-- 麦克风 --> 
<key>NSMicrophoneUsageDescription</key> 
<string>App需要您的同意,才能访问麦克风</string> 
<!-- 位置 --> 
<key>NSLocationUsageDescription</key> 
<string>App需要您的同意,才能访问位置</string> 
<!-- 在使用期间访问位置 --> 
<key>NSLocationWhenInUseUsageDescription</key> 
<string>App需要您的同意,才能在使用期间访问位置</string> 
<!-- 始终访问位置 --> 
<key>NSLocationAlwaysUsageDescription</key> 
<string>App需要您的同意,才能始终访问位置</string> 
<!-- 日历 --> 
<key>NSCalendarsUsageDescription</key> 
<string>App需要您的同意,才能访问日历</string> 
<!-- 提醒事项 --> 
<key>NSRemindersUsageDescription</key> 
<string>App需要您的同意,才能访问提醒事项</string> 
<!-- 运动与健身 --> 
<key>NSMotionUsageDescription</key> 
<string>App需要您的同意,才能访问运动与健身</string> 
<!-- 健康更新 --> 
<key>NSHealthUpdateUsageDescription</key> 
<string>App需要您的同意,才能访问健康更新 </string> 
<!-- 健康分享 --> 
<key>NSHealthShareUsageDescription</key> 
<string>App需要您的同意,才能访问健康分享</string> 
<!-- 蓝牙 --> 
<key>NSBluetoothPeripheralUsageDescription</key> 
<string>App需要您的同意,才能访问蓝牙</string> 
<!-- 媒体资料库 --> 
<key>NSAppleMusicUsageDescription</key> 
<string>App需要您的同意,才能访问媒体资料库</string>

3 error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods

error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods

解决方案:

 1 删除项目下的 xcworkspace 
 2 重新执行 pod install
 3 clean bulid folder

4 grep -r advertisingIdentifier .

grep -r advertisingIdentifier . 复制到相应工程目录下执行. 切记后面.是必须的
主要在苹果提交审核时,有提示是否使用 IDFA ,如果有使用就要说明作了什么用途,否则存在你选了否就会把这个二进制文件删了并不会再允许该二进制文件上传

5 Command PhaseScriptExecution failed with a nonzero exit code

Xcode菜单栏选择File-- Workspace Setting,把new build system(Defalt)切换到 Legacy Build System 在模拟器上运行就OK!

6 Could not locate device support files

问题地址

主要是版本不一致时出现这个问题,真机调试和xcode版本(xcode不同版本支持调试设备版本也不一样)

7 iOS项目真机运行时提示 Development cannot be enabled while your device is locked

问题方案

8 iTunes Store operation failed. This bundle is invalid. The value for key CFBundleShortVersionString [1.0.0] in the Info.plist file must contain a higher version than that of the previously approved version [1.0.0].

提示上传版本必须大于应用商店中的版本,修改版本后即可

9 Failing to archive the app with xCode: path_provider/PathProviderPlugin.h file not found

问题 flutter issues

首先先执行 flutter build ios
在Xcode打开ios/Runner.xcworkspace文件,而不是ios/Runner.xcodeproj文件

10 flutter Could not find the built application bundle at build/ios/iphonesimulator/Runner.app

修改 info.plistdisplay name 改成一样的再尝试着运行即可成功.

11 如何通过夜神模拟器来预览 flutter 应用:

  • 安装夜神模拟器
  • 找到对应模拟器安装目录 (C:\Users\Administrator\Nox\bin) 具体根据自己安装来确定
  • 唤起 CMD 命令, 进入当前目录执行 nox_adb.exe connect 127.0.0.1:62001 启动模拟器

12 Check failed: android_surface_. Could not create an OpenGL, Vulkan or Software surface to setup rendering.

flutter run --enable-software-rendering -d all 替代 flutter run 从命令来看就是启动硬件加速
issues: flutter/flutter#22671

13 Cannot provide both a color and a decoration

如果给一个容器指定颜色时 color 和 decoration 同级不能同时存在

	Container(
      decoration: {
      },
      color: Colors.red
   )

14 Flutter TextField 不能直接放到 Row 里面

报错信息 :BoxConstraints forces an infinite width.

错误用法

	
   Row(
		children: <Widget>[
			TextField(),
		],
	);

使用 Expanded 包裹 TextField

Row(
  children: <Widget>[
    Expanded(
      child: TextField()
    )
  ]
);

升级版本时遇到的一个问题


	Flutter Build Error: Process 'command 'User\****\flutter\bin\flutter.bat'' finished with non-zero exit value 1

具体解决方案:

在flutter开发中ListView嵌套ListView时,俩个ListView都会滚动,而不是一个整体,只需要设置子组件不滚动,并设置高度就可以解决这个问题

	Widget build(BuildContext context) {
    return ListView(
      children: <Widget>[
        Container(
          child: SwiperPage(),
          height: 200.0,
        ),
        Container(
          child: bookList(),
        ),
      ],
    );
  }

  Widget childList() {
    return ListView.builder(
        shrinkWrap: true, //解决无限高度问题
        physics: new NeverScrollableScrollPhysics(), //禁用滑动事件
        itemCount: 20,
        itemBuilder: (BuildContext context, int index) {
          return Container(
            margin: EdgeInsets.only(top: 20),
            padding: EdgeInsets.only(left: 20),
            child: Text('aaaaa' + index),
          );
        });
  }

Flutter 中 RowButton 间距问题的解决方案

1 自定义Button ,通过 inkwell 处理点击事件
2 通过 ButtonTheme 来更改
3 通过 给 Row 中的Button添加 Expand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant