真机调试用flutter开发ios应用时出现的问题的总结
用flutter开发ios应用在真机调试时出现的问题以及处理方式
1.无法连接iphone手机
需要运行如下命令
brew update
brew install --HEAD libimobiledevice
brew install ideviceinstaller ios-deploy cocoapods
pod setup
有可以出现问题的地方
就是brew install --HEAD libimobiledevice这里
brew install --HEAD libimobiledevice
==> Cloning [https://git.libimobiledevice.org/libimobiledevice.git](https://git.libimobiledevice.org/libimobiledevice.git) Updating /Users/rjoiner/Library/Caches/Homebrew/libimobiledevice--git
==> Checking out branch master Already on 'master' Your branch is up to date with 'origin/master'. HEAD is now at b34e343 tools: Remove length check on device UDID arguments to support newer devices
==> ./autogen.sh Last 15 lines from /Users/rjoiner/Library/Logs/Homebrew/libimobiledevice/01.autogen.sh: checking dynamic linker characteristics... darwin16.7.0 dyld checking how to hardcode library paths into programs... immediate checking for pkg-config... /usr/local/opt/pkg-config/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes checking for libusbmuxd >= 1.1.0... no configure: error: Package requirements (libusbmuxd >= 1.1.0) were not met:
Requested 'libusbmuxd >= 1.1.0' but version of libusbmuxd is 1.0.10
我们会发现异常所在Requested 'libusbmuxd >= 1.1.0' but version of libusbmuxd is 1.0.10,很显然是由于系统要求的*libusbmuxd *版本和所要安装的版本不一致。
应该是要更新libimobiledevice了,更新的命令如下:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
好,解决了上面的问题,我们应该就可以连上真机了。
2. Signing for "xxx" requires a development team. Select a development team
首次用vscode连上真机以后,点击调试,会出现如下问题:
No Provisioning Profile was found for your project's Bundle Identifier or your
device. You can create a new Provisioning Profile for your project in Xcode for
your team 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
It's also possible that a previously installed app with the same Bundle
Identifier was signed with a different certificate.
For more information, please visit:
https://flutter.io/setup/#deploy-to-ios-devices
Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
2018-10-27 12:09:29.004 ios-deploy[91734:221562] [ !! ] Error 0xe8008015: A valid provisioning profile for this executable was not found. AMDeviceSecureInstallApplication(0, device, url, options, install_callback, 0)
Could not install build/ios/iphoneos/Runner.app on b53d6902af4ac5d5166a3125b9013886739c92d2.
Try launching Xcode and selecting "Product > Run" to fix the problem:
open ios/Runner.xcworkspace
Error launching application on xxx的 iPhone.
Exited (sigterm)
大概的意思就是让我们用xcode打开 flutter项目/ios/Runner.xcworkspace 这个文件,好我们手动打开,点击编译,会出现如下问题
出现这个问题的原因是你的xcode project 中的team没有选择,选择方法如下。
3. 不受信任的开发者
解决方式:打开手机上的"设置->通用->设备管理->开发者应用",进入以后,点击"信任 xxxxx@xxx.com"