I have xcode 4.5.1 and want to add photos to the iphone 6.0 simulator but cant find it. I have a folder named iphone simulator but it just contains 4.3.1. It may be because some months ago I drag almost everything in the application support to my extern hard drive to save some memory. Now when I drag it back it contains the 4.3.1 which I used before. Do I have to download something on new or what should I do?
Thanks in advance!
Run the simulator
Run Safari on the Simulator
Drag a picture onto Safari running on the Simulator, this opens the image.
Click and hold on the image, or tap on the share icon in the bottom tool bar.
You'll get an alert asking if you want to store the image to your phone
There is a slightly faster approach than what Abizern described
Open the Simulator
Drag an image directly onto it (no need to launch Safari.app)
Safari willl launch
Long-Press the image and save it to the Simulators Camera Roll
Update for iOS9: Locally stored images can be dragged directly onto the simulator and don't have to be saved explicitly.
Please note that your images are stored here (6.1 matches the Simulator version):
~/Library/Application Suppport/iPhone Simulator/6.1/Media/DCIM/100APPLE
Unfortunately you can't just add images to that folder as they will be ignored because they're not in the image database of the Simulator. However you can get all the stored images via the Finder.
With Xcode 6 is easier.
1.- Drag and drop an Image to the Simulator and the image will appear directly in the native Photos app.
You can also now do this through the command line with smctl addmedia command.
$ xcrun simctl addmedia
Usage: simctl addmedia <device> <path> [... <path>]
You can specify multiple files including a mix of photos and videos.
You can also specify multiple live photos by providing the photo and video files. They will automatically be discovered and imported correctly.
Note (you may not need to add xcrun in front of simctl depending on how command line tools are installed).
To find the correct device id, run simctl list devices
$ xcrun simctl list devices
== Devices ==
-- iOS 10.2 --
iPhone 5 (D226CF12-6782-4D7D-9C00-2D662CF4022C) (Shutdown)
iPhone 5s (34E0E0F8-3429-4D91-B038-ECF4FD0F3311) (Shutdown)
iPhone 6 (9C772A68-34E3-4F3F-981C-543DE6D5D985) (Shutdown)
iPhone 6 Plus (7848A50E-BFB5-4F19-BB31-4A56CA78AA2C) (Shutdown)
iPhone 6s (12CF89BA-C8B2-4837-B4EB-FB24DFF1622C) (Shutdown)
iPhone 6s Plus (3EE6CA84-8F12-4A5E-A31D-EF4BF3CCBDB2) (Shutdown)
iPhone 7 (1EB3CE5D-849C-491C-9CAA-5E97B1BD89CE) (Booted)
iPhone 7 Plus (94FEFD36-6EFF-4762-BD21-79B1F958F6C6) (Shutdown)
iPhone SE (E8E8ECEB-34C0-44F0-B92E-57DCA91024F1) (Shutdown)
iPad Retina (0DA5BF39-3DC7-49B3-BE9B-2FA756FCA725) (Shutdown)
iPad Air (DAB9C2D3-8EBC-41DC-9C2D-0ECEC1D2FAE3) (Shutdown)
iPad Air 2 (1E2DA170-5C2E-413C-831B-FA65524643D3) (Shutdown)
iPad Pro (9.7 inch) (99F931A9-0708-4637-9294-6420DC7A149C) (Shutdown)
iPad Pro (12.9 inch) (08CD02EB-C44A-4183-961A-EED89FF1C225) (Shutdown)
-- tvOS 10.1 --
Apple TV 1080p (7EE393F2-C83E-467F-9802-3E5BFE7C2CA9) (Shutdown)
-- watchOS 3.1 --
Apple Watch - 38mm (B8969533-D7CD-462E-9E76-511C08E8CC8E) (Shutdown)
Apple Watch - 42mm (E16167D9-1007-438B-8812-CD97CE6ABECA) (Shutdown)
Apple Watch Series 2 - 38mm (F59C0BB1-B4D0-47DD-B927-1BFD78DD78C0) (Shutdown)
Apple Watch Series 2 - 42mm (7FE3AADD-94AB-46B9-A057-78F20F030999) (Shutdown)
So to add a video to my iPhone 7 simulator, I would use:
$ xcrun simctl addmedia 1EB3CE5D-849C-491C-9CAA-5E97B1BD89CE <path to video>
With the drag and drop feature you will lose all the metadata of the photos.
I've created a project that make it really easy to import assets to the simulator: MBAssetsImporter.
It enables you to import both videos and photos while preserving all the original metadata of the files.
This is MUCH easier with the new iOS Simulator that comes with Xcode 6+ (iOS Simulator 8.1 and above.) Now all you have to do is drag one or more photos onto the iOS Simulator window, and instead of opening Safari, the Photos app opens, and instantly adds all dragged-in photos to the device.
It's simple. Just goto photos in your iPhone simulator and drag images from your location (where the images Eg.Desktop) to IphoneSimulator. It add these picture in camera album.
Another easy way, in High Sierra with XCode 10, with your simulator running, select your photo in Photos, go the Share menu and select "Simulator".
Voilá!
Related
I made my entire app in Xcode 5.1.1. Saturday I downloaded Xcode 6.1 to make my app on iPhone 6 and 6+. I already placed the proper launch images and app icons for iPhone 6 and 6+. (For this app i'm not using size classes because Auto Layout doesn't work for me in this app.) I changed some of my code to fit iPhone 6 and 6+ but the simulator clearly isn't playing iPhone 6 and 6+ because none of the UIImageViews moved according to where I placed them with the code. It's still playing the zoomed in version of iPhone 5. How do I load the iPhone 6 and 6+ simulators according to my code and not the zoomed in version of iPhone 5?
I was told to place launch images for iPhone 6 and 6+ and it'd work, but it didn't.
here's what worked for me:
From the xcode pull down menus, Xcode > Open Developer Tool > iOS Simulator (if you get a pop up error just dismiss it)
Once in the Simulator go to Hardware > Device > Manage Devices.
Delete everything listed under simulator.
Reboot your machine.
After that navigate back to Manage Devices in the simulator and click the plus to add back your simulators. Then the iOS 8 simulators will show up. Hope that also helps you.
The old launch image asset doesn't provide the necessary support for iphone 6/6+. Remove your old LaunchImage item in your images.xcassets and create a new one. There will be additional options for adding the proper launch images for iphone 6/6+.
my app is live on itune appstore but its showing that it is compatible upto iphone 5/5S. But i had tested the app on iphone 6 and 6++ simulators and it is working fine.
What i have to do so that it should show that this app is compatible with iphone 6 and 6++
Thanks
In order to support iPhone 6 and iPhone 6 Plus compatibility, either you need to use a LaunchScreen file or simply add Launch images for 6/6Plus. Now when you try to run the app, it will automatically detect screen size and you can clearly see the app in correct dimension and size.
I am supporting iOS8 and greater in my App. However, I cannot get passed this Image Asset warning. What file am I missing? See the below screenshot:
an iphone retina (4-inch) launch image for ios 7.0 and later is required
You've suppled images for 4.7 and 5.5-inch devices but you need to have one for 4-inch devices as well (pre-iPhone 6).
You will need to select the checkboxes under "iOS 7 and later" (iPad ones if you're making an iPad app, iPhone one if iPhone app, all if Universal) at the right pane. These are used in both iOS 7 and 8.
How to change Display Zoom feature in iPhone 6 and 6 Plus simulators?
Original iPhone 6 and 6 Plus have this feature in Settings -> Display & Brightness -> Display Zoom (View) with values Standard and Zoomed.
As of Xcode 12 (and perhaps earlier) Settings -> Developer -> View -> Zoomed (tap Set) will adjust the simulator to show with Display Zoom. This is helpful as the iPhone 11 Pro, iPhone 12 mini, iPhone 12, and iPhone 12 Pro all run at a previously unused resolution of 320 x 693. For more information check out this excellent article by Geoff Hackworth.
Display Zoom is not available in the simulator (as of Xcode 6.0).
The answer is correct, Display Zoom is not available as an option in the current Xcode 7 iOS simulator settings. However, it is actually possible to 'simulate' Display Zoom when running your app in the simulator.
Background
When building a typical project for iPhone, you generally specify a LaunchScreen.storyboard file and/or launch images in Images.xcassets for the iPhone 4/4s (2x), iPhone 5/5s (Retina 4), iPhone 6/6s (Retina HD 4.7) and iPhone 6+/6s+ (Retina HD 5.5) and set those details in the project's settings. (See image below.)
When Display Zoom is turned ‘on’ for a iPhone 6/6s device, the device runs the app as if it was running on an iPhone 5/5s sized screen, upscaling the app x1.172 to fit the iPhone 6/6s display. (Similarly, when Display Zoom is turned ‘on’ for a iPhone 6+/6+s device, the device runs the app as if it was running on an iPhone 6/6s sized screen, upscaling the app to fit the iPhone 6+/6+s display.)
Note - The following instructions require the removal of some launch screen image files. You might wish to attempt these changes on a duplicate of your Xcode project.
Simulating Display Zoom on the iOS Simulator
To simulate Display Zoom for example using the iPhone 6 simulator in Xcode:
1 - Remove the LaunchScreen.storyboard file.
2 - Remove both the Retina HD 4.7 and Retina HD 5.5 launch images in Images.xcassets. (Make sure to keep the Retina 4 launch image.)
3 - Remove the reference to the ‘Launch Screen File’ in your Xcode project’s settings, under ‘General’, under ‘App Icons and Launch Images’.
4 - Select the iPhone 6/6s simulator, and then 'Run' your app.
Running your app
When the simulator runs your app, it will detect that no launch images are present for iPhone 6/6s, so it will presume it must be an iPhone 5/5s app and launch it into the simulator upsampling a iPhone 5/5s sized screen to fit the iPhone 6/6s screen, just as the Display Zoom setting would display it!
I'm running some test code on the simulator but need to reset the simulator contents each time before runs to make sure the data stored and cached by the app during execution is removed before each re-run of the test cases.
Is there a way to do this from within the tests?
You can use simctl to reset your simulators from the command line, which you could use in a script in your actions to run before a test scheme, but not individual test cases. You need to install the xcode command line tools
to reset the simulator use :
xcrun simctl erase <simulator device id>
to get the device ID you use :
$ xcrun simctl list devices
== Devices ==
-- iOS 10.2 --
iPhone 5 (D226CF12-6782-4D7D-9C00-2D662CF4022C) (Shutdown)
iPhone 5s (34E0E0F8-3429-4D91-B038-ECF4FD0F3311) (Shutdown)
iPhone 6 (9C772A68-34E3-4F3F-981C-543DE6D5D985) (Shutdown)
iPhone 6 Plus (7848A50E-BFB5-4F19-BB31-4A56CA78AA2C) (Shutdown)
iPhone 6s (12CF89BA-C8B2-4837-B4EB-FB24DFF1622C) (Shutdown)
iPhone 6s Plus (3EE6CA84-8F12-4A5E-A31D-EF4BF3CCBDB2) (Shutdown)
iPhone 7 (1EB3CE5D-849C-491C-9CAA-5E97B1BD89CE) (Booted)
iPhone 7 Low Disk Space (6CCF4C7A-606B-40B7-A8D8-DF8B3CB119CB) (Shutdown)
iPhone 7 Plus (94FEFD36-6EFF-4762-BD21-79B1F958F6C6) (Shutdown)
iPhone SE (E8E8ECEB-34C0-44F0-B92E-57DCA91024F1) (Shutdown)
iPad Retina (0DA5BF39-3DC7-49B3-BE9B-2FA756FCA725) (Shutdown)
iPad Air (DAB9C2D3-8EBC-41DC-9C2D-0ECEC1D2FAE3) (Shutdown)
iPad Air 2 (1E2DA170-5C2E-413C-831B-FA65524643D3) (Shutdown)
iPad Pro (9.7 inch) (99F931A9-0708-4637-9294-6420DC7A149C) (Shutdown)
iPad Pro (12.9 inch) (08CD02EB-C44A-4183-961A-EED89FF1C225) (Shutdown)
-- tvOS 10.1 --
Apple TV 1080p (7EE393F2-C83E-467F-9802-3E5BFE7C2CA9) (Shutdown)
-- watchOS 3.1 --
Apple Watch - 38mm (B8969533-D7CD-462E-9E76-511C08E8CC8E) (Shutdown)
Apple Watch - 42mm (E16167D9-1007-438B-8812-CD97CE6ABECA) (Shutdown)
Apple Watch Series 2 - 38mm (F59C0BB1-B4D0-47DD-B927-1BFD78DD78C0) (Shutdown)
Apple Watch Series 2 - 42mm (7FE3AADD-94AB-46B9-A057-78F20F030999) (Shutdown)
Device IDs remain constant I think until they're deleted or recreated, it would probably be possible to retrieve the device id of the booted simulator using some scripting magik (which I haven't yet worked out), the current active simulator is always marked as (Booted)
You can also use simctl to create custom simulators, just use xcrun simctl to list all the stuff it does.
You could use LUA script to do this with your automated testing. Have a look at http://www.coronalabs.com/blog/2011/08/11/automated-testing-on-mobile-devices-part4/ for detailed instructions.
Basically you will have lua use events to reset it.