How To Add Device In Xcode Simulator

broken image


Important:The information in this document is deprecated in Xcode 9. For Xcode 9 and later, see Simulator Help by choosing Help > Simulator Help in Simulator.

Xcode 12GM Build issues — Simulator /Device Cracked. Specifically, if I have lib/iOS and lib/iOSsimulator to contain the static libs for those specific platforms, how would I add them to the Xcode project so that when I build the app to test on physical device iOS device (arm64) or iOS simulator (x8664), Xcode chooses the correct lib to link with? Certainly, the current approach relying on.

Simulator app, available within Xcode, presents the iPhone, iPad, or Apple Watch user interface in a window on your Mac computer. You interact with Simulator by using the keyboard and the mouse to emulate taps, device rotation, and other user actions.

The chapter presents the basics of using Simulator. You can perform these steps using your own iOS app or, if you do not have an app to use, with the HelloWorld sample code. For more detailed information on interacting with Simulator and using it to test and debug your apps, refer to the later chapters in this guide.

Access Simulator from Xcode

There are two different ways to access Simulator through Xcode. The first way is to run your app in Simulator, and the second way is to launch Simulator without running an app.

Running Your iOS App

When testing an app in Simulator, it is easiest to launch and run your app in Simulator directly from your Xcode project. To run your app in Simulator, choose an iOS simulator—for example, iPhone 6 Plus, iPad Air, or iPhone 6 + Apple Watch - 38mm—from the Xcode scheme pop-up menu, and click Run. Xcode builds your project and then launches the most recent version of your app running in Simulator on your Mac screen, as shown in Figure 1-1.

Note: If you are testing an app with a deployment target of iPad, you can test only on a simulated iPad. If you are testing an app with a deployment target of iPhone or universal, you can test on either a simulated iPhone or a simulated iPad.

Running Your watchOS App

To run your WatckKit app, choose a combination of an iOS device and watchOS device from the Xcode scheme pop-up menu. For example, to run the watch app in a 38mm watch paired with an iPhone 6, choose 'iPhone 6 + Apple Watch - 38mm' from the scheme pop-up menu.

Running the WatchKit target launches two simulators, one for the iOS device and one for the watchOS device. Figure 1-2 shows an iPhone 6 and a 42mm watch running in two different simulators.

Running Your tvOS App

To run your tvOS App, choose a tvOS device from the Xcode scheme pop-up menu. Running the tvOS target launches the most recent version of your app in a simulated new Apple TV device, as shown in Figure 1-3.

Launching Simulator Without Running an App

At times, you may want to launch Simulator without running an app. This approach is helpful if you want to test how your app launches from the Home screen of a device or if you want to test a web app in Safari on a simulated iOS device.

To launch a Simulator without running an app

  1. Launch Xcode.

  2. Do one of the following:

    • Choose Xcode > Open Developer Tool > Simulator.

    • Control-click the Xcode icon in the Dock, and from the shortcut menu, choose Open Developer Tool > Simulator.

To launch a watchOS Simulator without running an app

  1. Launch Xcode.

  2. Do one of the following:

    • Choose Xcode > Open Developer Tool > Simulator (watchOS).

    • Control-click the Xcode icon in the Dock, and from the shortcut menu, choose Open Developer Tool > Simulator (watchOS).

Simulator opens and displays the Home screen of whichever simulated device was last used.

View the Installed Apps

From the Home screen, you have access to all of the apps that are installed in the simulation environment. There are two ways to access the Home screen in Simulator from your app:

  • Press Command-Shift-H.

  • Choose Hardware > Home.

Use the installed apps to test your app's interaction with them. For example, if you are testing a game, you can use Simulator to ensure that the game is using Game Center correctly.

iOS Device Home Screen

Much like the Home screen on an iOS device, the simulator's iOS Home screen has multiple pages. After clicking the Home button (or accessing the Home screen through the Hardware menu), you arrive at the second page of the Home screen. To get to the first page, where all of the preinstalled apps are found, swipe to the first Home screen by dragging to the right on the simulator screen.

On the Home screen, you see that all of the apps that have been preloaded into Simulator. See iOS Device Home Screen.

The apps that you see on the Home screen are specific to the iOS device simulation environment. Because Passbook and the Health app are available only for the iPhone, these apps don't appear if you are simulating a legacy device or an unsupported device type.

watchOS Device Home Screen

The Home screen for a simulated watchOS device behaves the same as it would on an actual device. You can click and drag to simulate the finger dragging around the screen and launch an app by clicking on it. Figure 1-4 shows the home screen of a 42mm watch with a developer app, the Lister sample code.

Use Safari to Test Web Apps

From the Home screen, you can access Safari within Simulator. Use Safari to test your iOS web apps directly on your Mac.

  1. From the Home screen, click Safari.

  2. In the address field in Safari, type the URL of your web app and press the Return key.

How To Use Xcode

If your Mac is connected to the Internet, it displays the mobile version of the URL you specified. For example, type apple.com into the address field and press Return. Safari displays the Apple website. See Figure 1-6.

Use Maps to Simulate Location Awareness

Simulator provides tools to assist you in debugging your apps. One of the many features you can debug in Simulator is location awareness within your app. Set a location by choosing Debug > Location > location of choice. The menu has items to simulate a static location or following a route.

A simulated watchOS device with the location set to None checks the paired iPhone device for the location.

Xcode Simulator Not Showing

You can specify your own location, which can be seen in the Maps app.

  1. From the Home screen, click Maps.

  2. Choose Debug > Location > Custom Location.

  3. In the window that appears, type the number 40.75 in the latitude field and the number -73.75 in the longitude field.

  4. Click OK.

  5. Click the Current Location button in the bottom-left corner of the simulated device screen.

After completing this task, notice that the blue dot representing your location is in New York, NY, near the Long Island Expressway, as shown in Figure 1-7.

Change the Simulated Device and OS Version

Simulator provides the ability to simulate many different combinations of device type and OS version. A device type is a model of iPhone, iPad, or Apple TV. Some iPhone devices can also have a paired Apple Watch. Each device-OS combination has its own simulation environment with its own settings and apps. Simulator provides simulators for common device-iOS, device-watchOS-iOS device, and device-tvOS combinations. You can also add simulators for a specific combination you want to test. However, not all device type and OS version combinations are available.

Note: To test apps for the iPad mini, use a simulated iPad with the same pixel resolution as the iPad mini.

You can switch between different device-OS combinations. Switching closes the window for the existing device and then opens a new window with the selected device. The existing device goes through a normal OS shutdown sequence, though the timeout might be longer than the one on a real device. The new device goes through a normal OS startup sequence.

To change the simulated device

  1. Choose a Hardware > Device > device of choice.

    Simulator closes the active device window and opens a new window with the selected device.

If the device type and OS version combination you want to use is not in the Device submenu, create a simulator for it.

To add a simulator

  1. Choose Hardware > Device > Manage Devices.

    Xcode opens the Devices window.

  2. At the bottom of the left column, click the Add button (+).

  3. In the dialog that appears, enter a name in the Simulator Name text field and choose the device from the Device Type pop-up menu.

  4. Choose the OS version from the iOS Version pop-up menu.

    Alternatively, if the iOS version you want to use isn't in the iOS Version pop-up menu, choose 'Download more simulators' and follow the steps to download a simulator.

  5. Click Create.

If the OS version you want to use is not installed, download it and follow the steps to add a simulator again.

To download a simulator

  1. In Xcode, choose Xcode > Preferences.

  2. In the Preferences window, click Downloads.

  3. In Components, find the legacy simulator version you want to add, and click the Install button.

You can also delete and rename simulators in the Devices window.

To delete a simulator

  1. In Simulator, choose Hardware > Device > Manage Devices, or in Xcode, choose Window > Devices.

    Xcode opens the Devices window.

  2. In the left column, select the simulator.

  3. At the bottom of the left column, click the Action button (the gear next to the Add button).

  4. Choose Delete from the Action menu.

  5. In the dialog that appears, click Delete.

To rename a simulator, choose Rename from the Action menu and enter a new name.

For how to manage real devices that appear in the Devices window, read Devices Window Help.

Mac

Alter the Settings of the Simulated Device

You can alter the settings within Simulator to help test your app.

On a simulated device, use the Settings app. To open the Settings app, go to the Home screen and click or on tvOS, choose Settings. In Figure 1-8 you see the Settings app as it appears when launched in the iOS simulation environment.

The Simulator settings differ from the settings found on a hardware device. Simulator is designed for testing your apps, whereas a hardware device is designed for use. Because Simulator is designed for testing apps, its settings are naturally focused on testing, too. For example, in a simulated iOS device the Accessibility menu provides the ability to turn on the Accessibility Inspector, and the Accessibility menu on a device allows you to turn on and off different accessibility features.

Through the settings, you can test both accessibility and localization of your app. See Testing and Debugging in iOS Simulator for information on how to manipulate your settings for the various types of testing you are interested in.

Remember: Changes made in the Settings app of simulated device affect only the simulation environment that is currently running.

Rotate iOS Devices

You can use Simulator to manipulate the simulated device much as you do a physical device.

To rotate your simulated device, choose Hardware > Rotate Left. When you rotate your simulated device, Settings rotates (see Figure 1-9), just as it would on a hardware device.

Test in Simulator and on a Device

Simulator is designed to assist you in designing, rapidly prototyping, and testing your app, but it should never serve as your sole platform for testing. One reason is that not all apps are available in the simulator. For example, the Camera app is available only on hardware devices and cannot be replicated in the simulator.

In addition, not all bugs and performance problems can be caught through testing in Simulator alone. You'll learn more about performance differences in Testing and Debugging in iOS Simulator. You can also find more information on testing your app on a device in Launching Your App on Devices in App Distribution Guide.

Quit Simulator

Simulator continues running until you quit it. Quitting Xcode will not close Simulator because they are separate applications. Similarly quitting simulator will not close Xcode.

To quit Simulator, choose Simulator > Quit Simulator. The device is shut down, terminating any running apps.

Note: Both Simulator and watchOS Simulator can be open at the same time.



Copyright © 2018 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2018-02-15

-->

Free provisioning allows Xamarin.iOS developers to deploy and test theirapps on iOS devices without being part of the Apple Developer Program.While simulator testing is valuable and convenient, it is also essential totest apps on physical iOS devices to verify that they function properlyunder real-world memory, storage, and network connectivity constraints.

To use free provisioning to deploy an app to a device:

  • Use Xcode to create the necessary signing identity (developercertificate and private key) and provisioning profile (containing anexplicit App ID and the UDID of a connected iOS device).
  • Use the signing identity and provisioning profile created by Xcode inVisual Studio for Mac or Visual Studio 2019 to deploy your Xamarin.iOSapplication.

Important

Automatic provisioningallows Visual Studio for Mac or Visual Studio 2019 to automatically setup a device for developer testing. However, automatic provisioning is notcompatible with free provisioning. In order to use automatic provisioning,you must have a paid Apple Developer Program account.

Requirements

How To Add Device In Xcode Simulator Codes

To deploy your Xamarin.iOS applications to a device with free provisioning:

  • The Apple ID being used must not be connected to the Apple Developer Program.
  • Your Xamarin.iOS app must use an explicit App ID, not a wildcard App ID.
  • The bundle identifier used in your Xamarin.iOS app must be unique and cannot have been used in another app previously. Any bundle identifier used with free provisioning cannot be re-used.
  • If you have already distributed an app, you cannot deploy that app with free provisioning.
  • If your app uses App Services, you will need to create a provisioning profile as detailed in the device provisioning guide.

Take a look at the Limitations section of this documentfor more information about limitations associated with free provisioning,and refer to the App distributionguides for more informationabout distributing iOS applications.

Testing on device with free provisioning

Follow these steps below to test your Xamarin.iOS app with free provisioning.

Xcode Simulator For Windows

Use Xcode to create a signing identity and provisioning profile

  1. If you do not have an Apple ID, create one.

  2. Open Xcode and navigate to Xcode > Preferences.

  3. Under Accounts, use the + button to add your existing Apple ID. It should look similar to the screenshot below:

  4. Close Xcode preferences.

  5. Plug in the iOS device to which you'd like to deploy your app.

  6. In Xcode, create a new project. Choose File > New > Project and select Single View App.

  7. In the new project dialog, set Team to the Apple ID that you just added. In the drop-down list, it should look similar to Your Name (Personal Team):

  8. Once the new project has been created, choose an Xcode build scheme that targets your iOS device (rather than a simulator).

  9. Open your app's project settings by selecting its top-level node in Xcode's Project Navigator.

  10. Under General > Identity, make sure that the Bundle Identifierexactly matches your Xamarin.iOS app's bundle identifier found in Info.plist.

    Important

    Xcode will only create a provisioning profile for an explicit AppID, and it must be identical to the App ID of your Xamarin.iOS app.If they differ, you will not be able to use free provisioning todeploy your Xamarin.iOS app.

  11. Under Deployment Info, ensure that the deployment target matches or is lower than the version of iOS installed on your connected iOS device.

  12. Under Signing, select Automatically manage signing and select your team from the drop-down list:

    Xcode will automatically generate a provisioning profile and signing identity for you. You can view this by clicking on the information icon next to provisioning profile:

    Tip

    If there is a failure when Xcode attempts to generate a provisioningprofile, make sure that Xcode's currently-selected build schemetargets the connected iOS device rather than a simulator.

  13. To test in Xcode, deploy the blank application to your device by clicking the run button.

Deploy your Xamarin.iOS app

Xcode simulator not showing

Alter the Settings of the Simulated Device

You can alter the settings within Simulator to help test your app.

On a simulated device, use the Settings app. To open the Settings app, go to the Home screen and click or on tvOS, choose Settings. In Figure 1-8 you see the Settings app as it appears when launched in the iOS simulation environment.

The Simulator settings differ from the settings found on a hardware device. Simulator is designed for testing your apps, whereas a hardware device is designed for use. Because Simulator is designed for testing apps, its settings are naturally focused on testing, too. For example, in a simulated iOS device the Accessibility menu provides the ability to turn on the Accessibility Inspector, and the Accessibility menu on a device allows you to turn on and off different accessibility features.

Through the settings, you can test both accessibility and localization of your app. See Testing and Debugging in iOS Simulator for information on how to manipulate your settings for the various types of testing you are interested in.

Remember: Changes made in the Settings app of simulated device affect only the simulation environment that is currently running.

Rotate iOS Devices

You can use Simulator to manipulate the simulated device much as you do a physical device.

To rotate your simulated device, choose Hardware > Rotate Left. When you rotate your simulated device, Settings rotates (see Figure 1-9), just as it would on a hardware device.

Test in Simulator and on a Device

Simulator is designed to assist you in designing, rapidly prototyping, and testing your app, but it should never serve as your sole platform for testing. One reason is that not all apps are available in the simulator. For example, the Camera app is available only on hardware devices and cannot be replicated in the simulator.

In addition, not all bugs and performance problems can be caught through testing in Simulator alone. You'll learn more about performance differences in Testing and Debugging in iOS Simulator. You can also find more information on testing your app on a device in Launching Your App on Devices in App Distribution Guide.

Quit Simulator

Simulator continues running until you quit it. Quitting Xcode will not close Simulator because they are separate applications. Similarly quitting simulator will not close Xcode.

To quit Simulator, choose Simulator > Quit Simulator. The device is shut down, terminating any running apps.

Note: Both Simulator and watchOS Simulator can be open at the same time.



Copyright © 2018 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2018-02-15

-->

Free provisioning allows Xamarin.iOS developers to deploy and test theirapps on iOS devices without being part of the Apple Developer Program.While simulator testing is valuable and convenient, it is also essential totest apps on physical iOS devices to verify that they function properlyunder real-world memory, storage, and network connectivity constraints.

To use free provisioning to deploy an app to a device:

  • Use Xcode to create the necessary signing identity (developercertificate and private key) and provisioning profile (containing anexplicit App ID and the UDID of a connected iOS device).
  • Use the signing identity and provisioning profile created by Xcode inVisual Studio for Mac or Visual Studio 2019 to deploy your Xamarin.iOSapplication.

Important

Automatic provisioningallows Visual Studio for Mac or Visual Studio 2019 to automatically setup a device for developer testing. However, automatic provisioning is notcompatible with free provisioning. In order to use automatic provisioning,you must have a paid Apple Developer Program account.

Requirements

How To Add Device In Xcode Simulator Codes

To deploy your Xamarin.iOS applications to a device with free provisioning:

  • The Apple ID being used must not be connected to the Apple Developer Program.
  • Your Xamarin.iOS app must use an explicit App ID, not a wildcard App ID.
  • The bundle identifier used in your Xamarin.iOS app must be unique and cannot have been used in another app previously. Any bundle identifier used with free provisioning cannot be re-used.
  • If you have already distributed an app, you cannot deploy that app with free provisioning.
  • If your app uses App Services, you will need to create a provisioning profile as detailed in the device provisioning guide.

Take a look at the Limitations section of this documentfor more information about limitations associated with free provisioning,and refer to the App distributionguides for more informationabout distributing iOS applications.

Testing on device with free provisioning

Follow these steps below to test your Xamarin.iOS app with free provisioning.

Xcode Simulator For Windows

Use Xcode to create a signing identity and provisioning profile

  1. If you do not have an Apple ID, create one.

  2. Open Xcode and navigate to Xcode > Preferences.

  3. Under Accounts, use the + button to add your existing Apple ID. It should look similar to the screenshot below:

  4. Close Xcode preferences.

  5. Plug in the iOS device to which you'd like to deploy your app.

  6. In Xcode, create a new project. Choose File > New > Project and select Single View App.

  7. In the new project dialog, set Team to the Apple ID that you just added. In the drop-down list, it should look similar to Your Name (Personal Team):

  8. Once the new project has been created, choose an Xcode build scheme that targets your iOS device (rather than a simulator).

  9. Open your app's project settings by selecting its top-level node in Xcode's Project Navigator.

  10. Under General > Identity, make sure that the Bundle Identifierexactly matches your Xamarin.iOS app's bundle identifier found in Info.plist.

    Important

    Xcode will only create a provisioning profile for an explicit AppID, and it must be identical to the App ID of your Xamarin.iOS app.If they differ, you will not be able to use free provisioning todeploy your Xamarin.iOS app.

  11. Under Deployment Info, ensure that the deployment target matches or is lower than the version of iOS installed on your connected iOS device.

  12. Under Signing, select Automatically manage signing and select your team from the drop-down list:

    Xcode will automatically generate a provisioning profile and signing identity for you. You can view this by clicking on the information icon next to provisioning profile:

    Tip

    If there is a failure when Xcode attempts to generate a provisioningprofile, make sure that Xcode's currently-selected build schemetargets the connected iOS device rather than a simulator.

  13. To test in Xcode, deploy the blank application to your device by clicking the run button.

Deploy your Xamarin.iOS app

How To Add Device In Xcode Simulator Roblox

  1. Connect your iOS device to the Mac build host via USB or wirelessly.

  2. In the Visual Studio for Mac Solution Pad, double-click on Info.plist.

  3. In Signing, select Manual Provisioning.

  4. Click the iOS Bundle Signing… button.

  5. For Configuration, select Debug.

  6. For Platform, select iPhone.

  7. Select the Signing Identity created by Xcode.

  8. Select the Provisioning Profile created by Xcode.

    Tip

    If you cannot see your signing identity or the correct provisioningprofile, you may need to restart Visual Studio for Mac.

  9. Click OK to save and close the Project Options.

  10. Select your iOS device and run the app.

  1. Make sure that Visual Studio 2019 or Visual Studio 2017 has been paired to a Mac build host.

  2. Connect your iOS device to the Mac build host via USB or wirelessly.

  3. In the Visual Studio 2019 or Visual Studio 2017 Solution Explorer, right-click on your Xamarin.iOS project and select Properties.

  4. Navigate to iOS Bundle Signing.

  5. For Configuration, select Debug.

  6. For Platform, select iPhone.

  7. Select Manual Provisioning.

  8. Select the Signing Identity created by Xcode.

  9. Select the Provisioning Profile created by Xcode.

    Tip

    Xcode created this signing identity and provisioning profile andstored them on your Mac build host. They are accessible toVisual Studio 2019 or Visual Studio 2017 since it has been pairedto the Mac build host. If they are not listed, you may need to restartVisual Studio 2019 or Visual Studio 2017.

  10. Save and close the project properties.

  11. Select your iOS device and run the app.

Limitations

Apple has imposed a number of limitations on when and how you can use free provisioning to run your application on an iOS device, ensuring that you can only deploy to your device:

  • Access to iTunes Connect is limited and therefore services such as publishing to the App Store and TestFlight are unavailable to developers provisioning their applications freely. An Apple Developer Account (Enterprise or Personal) is required to distribute via Ad Hoc and In-House means.
  • Provisioning profiles created with free provisioning will expire after one week, and signing identities will expire after one year.
  • Since Xcode will only create provisioning profiles for explicit App IDs, you will need to follow the instructions above for every app that you wish to install.
  • Provisioning for most application services is not possible with free provisioning. This includes Apple Pay, Game Center, iCloud, In-App Purchasing, Push Notifications, and Wallet. Apple provides a full list of capabilities in the Supported capabilities (iOS) guide. To provision your app for use with application services, visit the Working with capabilities guides.

Summary

This guide explored the advantages and limitations of using free provisioning to install applications on an iOS device. It provided a step-by-step walkthrough that demonstrated how to use free provisioning to install a Xamarin.iOS app.

Related links





broken image