ios developer tiny share-20160712

今天讲如何运行起你上一节创建的工程,具体如下:

After you create your project from a template, build and run your app to see what the app looks like on a device. For macOS apps, just click the Run button in the toolbar and the app launches on your Mac. For other apps, you can develop and test your app on your Mac using a simulated device and later, test using a real device connected to your Mac.
Projects can have multiple targets—multiple apps and multiple configurations of the same app. A target specifies a product to build, such as an iOS, watchOS, or macOS app. Most projects you create from a template have one target for the main app and other targets for test apps. For watchOS apps, there’s a target for the iOS app, the WatchKit extension, and the WatchKit app. To view the targets, click the Project/Targets button in the project editor.


To run your app, choose a scheme from the Scheme pop-up menu in the toolbar. A scheme is a collection of settings that specify the targets to build, the build configuration, and the executable environment. Xcode creates a default scheme for each target in your project. Choose the scheme from the Scheme pop-up menu that matches your app’s name.


Next choose a run destination from the Scheme pop-up menu in the toolbar. The run destination determines where the app runs after it’s built. For macOS apps, the run destination is the Mac running Xcode. For other apps, you can choose a simulator of a product family running a version of the operating system, or a device connected to your Mac. To test your app without a device, choose a simulator from the Scheme pop-up menu. For tvOS apps, choose Apple TV 1080p under tvOS Simulator.


To test a WatchKit App target, choose the WatchKit App as the scheme, and choose an iPhone simulator paired to an Apple Watch as the run destination.


Now click the Run button in the toolbar to compile, link, and debug your app. The activity viewer in the toolbar shows the build progress and results. If an error or warning occurs, a corresponding yellow or red icon appears in the activity viewer and you can click it to view details in the issue navigator. Click the issue in the navigator and Xcode displays the line of code where the compiler error occurred.
If the build is successful, your macOS app launches on your Mac. For other apps, the app launches in Simulator—a developer tool included with Xcode that simulates devices. For iOS and tvOS apps created from a template, Simulator displays an empty view because you haven’t created the UI yet. For watchOS apps, Simulator opens both an iPhone simulator displaying the Home screen, and an Apple Watch simulator displaying an empty view.


In Simulator, you can simulate a physical user action—such as rotating or shaking an iOS device—using the Hardware menu. You can also simulate touch gestures and simulate Apple Watch interactions using the Mac pointer.


For iOS and tvOS apps, use the Settings app to configure the simulator. To open Settings, choose Hardware > Home and double-click Settings. For example, if your app uses iCloud services, you can enter iCloud credentials in Simulator before launching your app.


If the target launches successfully, Xcode starts a debug session in the debug area below the editor. To quit the app and the debug session, click the Stop button next to the Run button in the toolbar.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值