赞
踩
在iphone 或者ipad上,按照下面提示成为apple developoer
https://developer.apple.com/cn/support/app-account/
打开flutter 项目,进入根目录
$ flutter run -d <deviceId> # 指定设备ID
More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
iPhone • xxx • ios • iOS 12.4.5
iPhone SE (2nd generation) • xxx1 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)
$ flutter run -d xxx
You can connect to your Apple Developer account by signing in with your Apple ID
in Xcode and create an iOS Development Certificate as well as a Provisioning
Profile for your project 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
5- Trust your newly created Development Certificate on your iOS device
via Settings > General > Device Management > [your new certificate] > Trust
用XCode打开项目,
…略
依次进入: General-> Signing & Capabilities -> Release -> Signing -> Team
选择 appleID 生成证书
报错: cannot be registered to your development team because it is not available …
参照:
ios 真机运行:The app ID cannot be registered to your development team
所以我得修改bundle ID
依次进入 : General -> Identity -> Bundle Identity
证书生成完毕 (Expires in 6 days ) 因为我账号是Personal Team
报错: Code signing is required for product type ‘Application’ in SDK ‘iOS 13.4’
依次进入: Build Setting -> Code Signing Identity
Application 改成 IOS Developer
参照
编译时 linking and signing 会提示codesign权限
输入密码给权限就可以了
$ flutter run -d <xxx> Launching lib/main.dart on iPhone in debug mode... 2020-07-11 14:52:02.810 defaults[19414:161055] The domain/default pair of (/Users/apple/Desktop/vs_project/dcapp/ios/Runner/Info, CFBundleIdentifier) does not exist Automatically signing iOS for device deployment using specified development team in Xcode project: DHUPK94B63 Running Xcode build... ├─Assembling Flutter resources... 3.1s └─Compiling, linking and signing... 46.3s Xcode build done. 52.4s Installing and launching... 15.6s Could not install build/ios/iphoneos/Runner.app on xxx. Try launching Xcode and selecting "Product > Run" to fix the problem: open ios/Runner.xcworkspace Error launching application on iPhone.
打开app提示: 您的设备管理设置不允许在此台iPhone上
没有动行成功是因为手机要信任开发者账号
iphone 设置->通用->设备管理->对应的账号-> 信任
再次运行 flutter run 真机可以跑起来了.
提示:
It appears that your application still contains the default signing identifier.
Try replacing ‘com.example’ with your signing id in Xcode:
open ios/Runner.xcworkspace
Encountered error while building for device.
或者
提示 : Failed to register bundle identifier.
修改bundle identifier 为其它
选择 Generic iOS Device
XCODE -> PRODUCT -> Destination -> Generic iOS Device
XCODE -> PRODUCT -> Archive
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。