如果直接执行flutter build ios
:
Building com.example.myTimeApp for device (ios-release)...
════════════════════════════════════════════════════════════════════════════════
No valid code signing certificates were found
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- Make sure a 'Development Team' is selected under Signing & Capabilities > Team.
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
For more information, please visit:
https://developer.apple.com/library/content/documentation/IDEs/Conceptual/
AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html
Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
No development certificates available to code sign app for device deployment
即
为设备(ios-release)构建com.example.myTimeApp... ════════════════════════════════════════════════════════════════════════════════ 找不到有效的代码签名证书 您可以通过在Xcode中使用您的Apple ID登录并创建iOS开发证书以及为您的项目创建一个 配置文件来连接到您的Apple开发者帐户,方法如下: 1- 使用以下命令打开Flutter项目的Xcode目标: open ios/Runner.xcworkspace 2- 在导航器中选择“Runner”项目,然后选择“Runner”目标 在项目设置中 3- 确保在Signing & Capabilities > Team下选择了“Development Team”。 您可能需要: - 首先使用您的Apple ID在Xcode中登录 - 确保您拥有一个有效的唯一Bundle ID - 使用您的Apple开发者帐户注册您的设备 - 让Xcode自动为您的应用程序配置配置文件 4- 再次构建或运行您的项目 5- 在iOS设备上信任您新创建的开发证书 通过设置 > 通用 > 设备管理 > [您的新证书] > 信任
获取更多信息,请访问: https://developer.apple.com/library/content/documentation/IDEs/Conceptual/ AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html
或者在没有代码签名的情况下在iOS模拟器上运行 ════════════════════════════════════════════════════════════════════════════════ 没有可用的开发证书来对设备部署进行代码签名
要将Flutter应用程序编译为iOS上可用的app,需执行以下步骤:
-
安装Xcode
首先,需要在macOS系统上安装最新版本的Xcode。Xcode是Apple提供的集成开发环境,用于编写iOS、macOS、watchOS和tvOS应用程序。
-
配置iOS模拟器
启动Xcode,进入
Xcode > Preferences > Components
,并安装iOS模拟器组件。这将允许我们在macOS上运行和测试iOS应用程序。注意,Xcode事情比较多, 需要打开项目里面ios文件夹,不然会报错
could not open file(具体的路径)
-
创建iOS模拟器
在Xcode中,选择
Xcode > Open Developer Tool > Simulator
打开iOS模拟器。
