Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-11-2010, 03:54 AM   #1 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 65
Abel95 is on a distinguished road
Default Downloading plist

Hi, im trying to download a plist from a server and save it to the documents folder but it does not seem to work. Any help?
Here is what i have.

Code:
-(IBAction)getPlist{
NSString *folder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
	NSString *path = [folder stringByAppendingPathComponent:@"Data.plist"];
	
	NSURL *theFileURL = [NSURL URLWithString:@"http://www.somesite.com/Data.plist"];
	NSDictionary *newPlist = [[NSDictionary alloc] initWithContentsOfURL:theFileURL];
	[newPlist writeToFile:path atomically:YES];
	[newPlist release];	
}
Abel95 is offline   Reply With Quote
Old 09-11-2010, 06:54 PM   #2 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
smasher will become famous soon enough
Default

Code looks fine. Step through it with the debugger and see where the problem is.

Is theFileURL nil? Then check your url. Is newPlist nil? Check the format of your Plist file. Is writeToFile returning true or false? If false, check your path. If true, print the path to the console and make sure the file is really there.
__________________

Free Games!

Last edited by smasher; 09-11-2010 at 06:59 PM.
smasher is offline   Reply With Quote
Old 09-11-2010, 07:04 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 65
Abel95 is on a distinguished road
Default

Thanks but i figured i rather read the plist from the site rather than download it.
Abel95 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 343
13 members and 330 guests
bignoggins, carlandrews, cgokey, flamingliquid, givensur, hzwegjxg, ilmman, jenniead38, linkmx, mraalex, PixelInteractive, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:56 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0