Testing An Ios App On A Device
Testing An Ios App On A Device
There are some features of iOS apps that don’t work from the iOS simulator. Maybe you want to test how your application works with the device camera or send an SMS message from your application. For these examples and more you’ll need to test and debug your app using a real device.
![Testing ios app on device Testing ios app on device](https://docs.phpfox.com/download/attachments/3309735/2.png?version=2&modificationDate=1545272848000&api=v2)
However, did you know that there could be bugs that only show up when your app is running on an actual iOS device? Furthermore, testing your iOS app on a device is the best way to gauge performance issues before you go too far down the road. For those of us who don’t have actual iOS devices, the Simulator is actually really good. Mobile, app, testing, device cloud, farm. Testing mobile apps can be a pain, especially with the wide range of OS versions in the Android ecosystem and myriad devices with different screen sizes, resolutions, capabilities and so on - while iOS developers, of course, enjoy a far narrower scope of testing requirements.
This post will walk through how to run the Xcode simulator on your iPhone or other iOS device and show you how to fix some common errors you’ll see along the way.
How to select your iPhone as the “Simulator” Device
Simulator is in quotes here since this will create an actual app on your phone; it’s no longer a simulation. Open up a project in Xcode and click on the device near the Run ▶ button at the top left of your Xcode screen.
Plug your iPhone into your computer. You can select your device from the top of the list.
Unlock your device and (⌘R) run the application. You’ll see Xcode install the app and then attach the debugger. The application should pop up on your phone.
Troubleshooting Common Errors
The first time I tried to connect my iPhone to Xcode it didn’t work. According to my best friend, Stack Overflow, I’m not the only one who has had issues. Let’s share the fixes to some common errors you might encounter.
“Signing Requires a Development Team”
Xcode requires that you’ve connected a Team to your project in order to run the simulator on a device. You can do this from the “General” tab of your Project Settings. As of Xcode 7 this can be any Apple ID.
Open the Team menu that currently says “None” and select your team. If you don’t have a team, select “Add an Account…” and create one with your Apple ID.
Xcode claims your device is locked when it isn’t
![App App](https://experitest.s3.amazonaws.com/website/images/solutions/iospage/ios-app-testing-devices.jpg)
This fun bug has been happening since at least Xcode 6. There are a lot of potential solutions in this Stack Overflow post. Here’s what worked for me:
- Unplug your iPhone
Reset Location & Privacy
on your iPhone. Found underSettings >> General >> Reset
- Plug in your iPhone
- Hit
Trust
when prompted toTrust This Computer
You can learn more about how trusting computers works from Apple’s support.
“iPhone is Busy”
The unsatisfying answer for this one is to just wait.
If you don’t have a sword fighting partner, you can try the following:
- Unplug your device
- Restart both Xcode and your iPhone
- Plug in your device
That worked for me, but a lot of folks had luck with “Solution #3” from this Stack Overflow post.
Activate your Debugging Superpowers
The Jasonette docs FAQ has some more tips if you have other related issues. Now that you’ve got your application running on a device you can make the most of your testing and debugging experience with these tips:
If you have any questions or run into any other issues, feel free to reach out to me on Twitter @kelleyrobinson.
This guide explains how to receive test ads in your ads integration. It isimportant to use test ads during development so that you can click on themwithout charging Google advertisers. If you click on too many ads without beingin test mode, you risk your account being flagged for invalid activity.
There are two ways to get test ads:
- Use one of Google's demo ad units.
- Use your own ad unit and enable test mode.
Prerequisite
- Complete Get Started.
Demo ad units
The quickest way to enable testing is to use Google-provided demo ad units.These ad units are not associated with your AdMobaccount, so there's no risk of your account generating invalid traffic whenusing these ad units.
Key Point: Make sure you replace these test IDs with your own ad unit ID beforepublishing your app.Here are demo ad units that point to specific test creatives for each format:
Ad format | Demo ad unit ID |
---|---|
App Open | ca-app-pub-3940256099942544/5662855259 |
Banner | ca-app-pub-3940256099942544/2934735716 |
Interstitial | ca-app-pub-3940256099942544/4411468910 |
Interstitial Video | ca-app-pub-3940256099942544/5135589807 |
Rewarded Video | ca-app-pub-3940256099942544/1712485313 |
Native Advanced | ca-app-pub-3940256099942544/3986624511 |
Native Advanced Video | ca-app-pub-3940256099942544/2521693316 |
Enable test devices (Test mode)
If you want to do more rigorous testing with production-looking ads, you cannow configure your device as a test device and use your own ad unit IDs thatyou've created in the AdMob UI.Test devices can either be added in the AdMob UI or programmatically using theGoogle Mobile Ads SDK.
Follow the steps below to add your device as a test device.
Key Point: iOS simulators are automatically configured as test devices.Add your test device in the AdMob UI
For a simple, non-programmatic way to add a test device and test new or existingapp builds, use the AdMob UI. Learnhow.
Key Point:Testing An Ios App On A Device Windows 10
New test devices typically start serving test ads in your app within15 minutes, but it can also take up to 24 hours.Add your test device programmatically
If you want to test ads in your app as you're developing, follow thesteps below to programmatically register your test device.
- Load your ads-integrated app and make an ad request.
- Check the console for a message that looks like this:Copy your test device ID to your clipboard.
- Modify your code to set the test device ID through
testDeviceIdentifiers
:Be sure to remove the code that sets these test devices before yourelease your app.Swift
Objective-C
Re-run your app. If the ad is a Google ad, you'll see a Test mode labelcentered at the top of the ad (banner, interstitial, or rewarded video):
To see the Test mode label, you need to be using an SDK version of7.59.0 or higher. In versions 7.26.0 to 7.58.0 the label will say Test Ad.For native advanced ads, the headline asset is prepended with the string'Test mode'.
Ads with this Test mode label are safe to click. Requests, impressions, andclicks on ads in test mode will not show up in your account's reports.
Mediated ads do NOT render a Test mode label. See the sectionbelow for details.
Testing with mediation
Test Ios Apps On Windows
Google's demo ad units only show Google ads. To test your mediationconfiguration, you must use the enable test devicesapproach.
Install Test App On Iphone
Mediated ads do not render a Test mode label. You are responsible forensuring that test mode is enabled for each of your mediation networks so thatthese networks don't flag your account for invalid activity. See each network'srespective mediation guide formore information.
Testing An Ios App On A Device Download
If you aren't sure whether a mediation ad network adapter provides a test mode,it is safest to avoid clicking on ads from that network during development. Youcan use theadNetworkClassName
property on any of the ad formats to figure out which ad network served thecurrent ad.
Testing An Ios App On A Device