Flutter遇到的问题,持续更新

1.cocoapod安装

可以用清华的网址下载cocoapod,速度更快

podfile文件使用清华镜像

 source  'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

新项目或更新依赖  pod install安装

2.flutter build ios

xcode11.4打开项目中的Runner.xcworkspace文件,然后product=>clean build folder=>archive

命令打包,打包出来的是包集合,体积大

使用xcode,可以进行签证书,根据手机型号或者打通用包

打包可以选择arm64减少体积,有的插件不支持armv7或X86,打包的时候会报错

企业版如果不是自己申请的证书,需要.p12证书才能发布

企业版选distribute app=>enterprise=>app thinning(可选:none通用的,all compatible device variants所有机型的,单独机型)=>automatically manage signing(自动签证书)=>export(导出包文件)

3.回调,传参时如果是方法不要带括号

4.flutter的https验证证书是个坑

5.ios不支持webm格式的视频

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Flutter 是一个流行的跨平台移动应用程序开发框架,可用于 iOSAndroid 平台。要实现后台持续定位,你可以使用 Flutter 的 geolocator 插件。 首先,你需要在 pubspec.yaml 文件中添加 geolocator 依赖项。 ```yaml dependencies: geolocator: ^5.3.2+2 ``` 然后,在你的代码中导入 geolocator 库,创建一个 Geolocator 实例并启动位置流。 ```dart import 'package:geolocator/geolocator.dart'; // 创建一个 Geolocator 实例 final Geolocator geolocator = Geolocator()..forceAndroidLocationManager; // 启动位置流,要求持续定位 StreamSubscription<Position> positionStream = geolocator.getPositionStream( desiredAccuracy: LocationAccuracy.high, distanceFilter: 10, // 10米以上的移动才会触发位置更新 ).listen((Position position) { // 处理位置变化 }, onError: (error) { // 处理错误 }); ``` 在应用程序处于后台运行时,你需要在 AndroidManifest.xml 文件中添加一些配置,以确保应用程序可以继续接收位置更新。在 \<application> 标记内部添加以下代码: ```xml <service android:name="com.lyokone.location.LocationService" /> <receiver android:name="com.lyokone.location.LocationBroadcastReceiver" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.QUICKBOOT_POWERON" /> </intent-filter> </receiver> ``` 最后,在你的代码中添加以下代码,以确保应用程序在终止时停止位置流。 ```dart // 停止位置流 positionStream.cancel(); ``` 希望这可以帮助你实现后台持续定位。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值