IOS开发之——将项目运行到真机中

一 概述

与安卓开发不同,iOS开发需要开发者账号或apple id

  • 模拟器时:Debug模式和Release模式都可以直接运行,不需要开发者账户
  • 真机时:需要添加开发者账户,才能在真机中运行

二 将代码运行到设备中

2.1 模拟器

终端设备选择模拟器,States显示账号警告,可以直接运行

2.2 真机

出现错误(States)
Signing for "xxx" requrires a developement team.Select a development team in the Signing & Capabilities editor.
异常现象

三 创建Apple Developer

3.1 注册条件

  • 已开启双重认证的 Apple ID
  • iPhone或iPad上注册Apple Developer Program(Appstore 搜索Developer)
  • 注册会员资格续费(688人民币/年)

3.2 注册地址

  • Apple ID注册地址:https://appleid.apple.com/account?appId
  • Apple Developer Program:https://developer.apple.com/cn/programs/

3.3 注册结果

注册结果
Your request could not be processed

反馈结果

3.4 注册结果说明

  • 按照正常流程注册时,会出现错误,官方并未给出失败原因及失败处理方案
  • 我们可以继续使用Apple ID进行开发

四 Xcode管理Apple ID

4.1 添加Apple ID

打开Xcode开发工具,依次点击:Xcode——>Preferences

在弹出的对话框中,切换到Accounts选项卡

点击+,并选择添加账户类型


选择Apple ID登陆并登陆

添加成功后的效果

4.2 删除Apple ID

选中Apple IDs列表中的条目,并点击-

五 将项目运行到真机中

5.1 原生项目

原生项目:Targets——>Signing&Capabilities——>All——>Signing,选择Team

选择运行到真机设备中,Xcode和真机设备显示如下信息

Xcode真机
信息The operation couldn’t be completed. Unable to launch com.example.iosDevices because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user.不受信任的开发者。你的设备管理设置不允许在这台iPad上使用开发者“Apple Development:xxx”的App。你可以在“设置”中允许使用这些App
图片

真机设备:设置——>通用——>设备管理

设备管理器中选择账户,选择信任xxx

此种情况下app的有效期

5.2 Flutter项目

Debug模式运行时,关闭Flutter,从Home页面打开时,显示如下,Release模式正常

in IOS14+,debug mode Flutter apps can only be launched from Flutter tooling,IDEs with Flutter plugins or form Xcode.

Alternatively,build in profile or release modes to enable launching from the home screen

六 Debug和Release模式切换

在Xcode中,依次选择:Product——>Scheme——>Edit Scheme

在弹出的对话框中选择运行模式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值