• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: initFileURLWithPath run on emulator, not run on device
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: initFileURLWithPath run on emulator, not run on device


  • Subject: Re: initFileURLWithPath run on emulator, not run on device
  • From: David Duncan <email@hidden>
  • Date: Mon, 30 Jan 2012 11:42:27 -0800

On Jan 30, 2012, at 10:50 AM, Stephen J. Butler wrote:

> On Mon, Jan 30, 2012 at 9:57 AM, Riccardo Barbetti
> <email@hidden> wrote:
>> I have a problem, after that I had write and test code on simulator, today I have work on device.
>
> I'm skeptical because...
>
>> In my program I save my NSArray:
>>
>>
>>    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSSharedPublicDirectory, NSUserDomainMask, YES);
>>
>>    NSString *documentsDirectory = [paths objectAtIndex:0];
>>    NSURL *URLDirectory = [[NSURL alloc] initFileURLWithPath:documentsDirectory];
>>
>>    BOOL result = [anArray writeToURL:URLDirectory atomically:YES];
>
> ... nowhere in this code do you add a filename to write to.


This is likely the root problem. The reason why it would work in the simulator but the device is likely due to permissions differences between the two. In the simulator you are typically allows to write practically anywhere in the simulated file system, since it is located inside of your home folder. On device you cannot write to the container directory of your application (which would be the permissions required to replace the 'Documents' folder).

As a rule, anything related to the hardware (such as the file system) is unlikely to be authoritative when working with the Simulator. The other common gotcha related to the file system is that typically your HD is formatted to be case insensitive, but iOS devices are formatted to be case sensitive.
--
David Duncan


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >initFileURLWithPath run on emulator, not run on device (From: Riccardo Barbetti <email@hidden>)
 >Re: initFileURLWithPath run on emulator, not run on device (From: "Stephen J. Butler" <email@hidden>)

  • Prev by Date: Re: NSPopUpButton Binding Frustration
  • Next by Date: Re: NSPopUpButton Binding Frustration
  • Previous by thread: Re: initFileURLWithPath run on emulator, not run on device
  • Next by thread: Re: initFileURLWithPath run on emulator, not run on device
  • Index(es):
    • Date
    • Thread