ios这次遇到一个奇葩的问题,真机调试时候,无论是flutter run 和 flutter run --release,都是没有任何问题的,可以把app打包后distribute提交到app store,真机通过app store安装,功能就会不正常,我怀疑是打包ipa的时候出的问题,被优化了?
这个问题就很难了,难道每次更改代码后判断是否修复,都要发布到app store?那这一等就是两天。
于是我决定Archive后,通过AdHoc方式打包为ipa文件,然后安装到真机上测试。
创建Ad hoc配置文件
https://developer.apple.com/account/
选择Profiles,添加,
![](https://img.haomeiwen.com/i2042197/bce53b86e68d5b92.png)
选择Adhoc
![](https://img.haomeiwen.com/i2042197/f5197b6ffad9a1f4.png)
选择一个app id(com.xx.xx)
![](https://img.haomeiwen.com/i2042197/c30133167a188d49.png)
选择真机运行设备
![](https://img.haomeiwen.com/i2042197/a2c03596e9fd7b49.png)
![](https://img.haomeiwen.com/i2042197/b66bb9d0e1e608ab.png)
![](https://img.haomeiwen.com/i2042197/ec0f8878cd3f6711.png)
打包ipa
首先Product->Archive
![](https://img.haomeiwen.com/i2042197/ed902f74748c890b.png)
Distribute APP,选择Ad hoc
![](https://img.haomeiwen.com/i2042197/6217bef5f279ff67.png)
一路Next,到了选择profile等时候,选择上面创建的adhoc配置,最后导出为ipad文件,保存到电脑。
![](https://img.haomeiwen.com/i2042197/2302826d3a52677c.png)
![](https://img.haomeiwen.com/i2042197/94de4f30b42e3dd7.png)
![](https://img.haomeiwen.com/i2042197/b9156d9d94031437.png)
把ipa文件 安装到手机
1.打开xcode
2.菜单栏-》window-》Devices and Simulators
![](https://img.haomeiwen.com/i2042197/0a56bf5ec671b484.png)
选择刚才保存到ipa文件
![](https://img.haomeiwen.com/i2042197/aa5b6a6740f7e436.png)
这样app就安装到真机里面了。
果然,这种方式就能复现bug了,和发布的app store是一样的打包优化过程。
修复bug
根据错误提示Failed to lookup symbol ... symbol not found,
根据这个第三方库的说明,如果出现这个错误,需要
在 Xcode 中,转到Target Runner > Build Settings > Strip Style
从所有符号更改为非全局符号
![](https://img.haomeiwen.com/i2042197/27ce5982df0df36f.png)
网友评论