Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS SDK 4.0 & 4.1 add images to simulator

I've seen many questions asked about how to add images to the simulator and have seen two answers:

  • Click and hold to save in Mobile Safari on the phone
  • Add the files to the 100Apple (or whatever) folder

Both worked great in everything previous to iOS SDK 4.0. Those same methods no longer work for me, and neither for anyone else that I have seen. I have tried to write an image to the photo library manually using the following chunk of code I found somewhere:

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{
    UIAlertView *alert;

    if (error) // Unable to save the image 
        alert = [[UIAlertView alloc] initWithTitle:@"Error" 
                                       message:@"Unable to save image to Photo Album." 
                                      delegate:self cancelButtonTitle:@"Ok" 
                             otherButtonTitles:nil];
    else // All is well
        alert = [[UIAlertView alloc] initWithTitle:@"Success" 
                                       message:@"Image saved to Photo Album." 
                                      delegate:self cancelButtonTitle:@"Ok" 
                             otherButtonTitles:nil];
    [alert show];
    [alert release];
}

But it errors every time. So is it a problem with the write access of the simulator? or just some bug? I have already updated to the iOS 4.1 SDK in hopes of it being fixed, but it isn't.

like image 541
alunsford3 Avatar asked Jul 20 '10 02:07

alunsford3


People also ask

Which SDK is used for iOS?

The central component of the iOS SDK is Xcode, Apple's interactive development environment (IDE). Xcode facilitates building apps for OS X, iOS and WatchOS. Xcode includes the interface, the LLVM compiler, instruments and iOS simulator tools that make development and testing possible without an Apple device.

What is iOS 13 SDK?

Overview. The iOS 13 SDK provides support for developing apps for iPhone devices running iOS 13. The SDK comes bundled with Xcode 11 available from the Mac App Store.

What iOS 14 SDK?

The iOS & iPadOS 14 SDK provides support to develop apps for iPhone, iPad, and iPod touch devices running iOS & iPadOS 14. The SDK comes bundled with Xcode 12, available from the Mac App Store.


3 Answers

I am using Xcode 3.2.4 with SDK 3.2, 4.0.1 and 4.1. The following steps worked for me: 1. Launch simulator 2. Drag an image from Finder to the simulator which will always launch Safari to show the image 3. CLICK and HOLD that click for a couple of seconds, then you will see a popup with a "Save Image" button

like image 90
Bing Wu Avatar answered Nov 05 '22 06:11

Bing Wu


I had the same problem running iOS Simulator 4.3 Using user44990 answer above fixed the problem for me and subsequently browsing in Safari and hold-click to save an image worked for me. I suspect the first step creates the proper directory: ~/Library/Application Support/iPhone Simulator/4.3.2/Media/DCIM/100APPLE which enable the click and hold method to work.

like image 37
dsm Avatar answered Nov 05 '22 08:11

dsm


This question is spot-on. All the current advice I've seen about dragging/dropping to Safari, creating DCIM\100APPLE, etc, are all ineffective in SDK 4.

like image 31
Philip Su Avatar answered Nov 05 '22 06:11

Philip Su