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 05-25-2010, 04:16 PM   #1 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 12
schem001 is on a distinguished road
Default Can not find my filepath document after saving:

I saving some data I collected using plist: info.plist

My questions is after saving all data, I want to retrieve it and see it (I have done it before using Organizer), but now the document does not even exist under app in organizer.

The filepath is outputted via debugger shows that the document path is created, but how can I find it???

Here is my result of debugger:

Code:
run
Running…
[Switching to thread 10755]
[Switching to thread 10755]
(gdb) continue
warning: UUID mismatch detected with the loaded library - on disk is:
	/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libgcc_s.1.dylib
=uuid-mismatch-with-loaded-file,file="/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libgcc_s.1.dylib"
2010-05-25 16:55:54.964 AccelerometerGraph[1426:207] /var/mobile/Applications/16AA4CC1-D3E6-4017-8728-E8263CF6967C/Documents/walk2.txt
2010-05-25 16:55:55.116 AccelerometerGraph[1426:207] Done Saving
I try to find that path in organizer under app, but just can not. Maybe sth has to do with bundle identifier, not sure though.

and here is my code for saving data:

Code:
		NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);   
		NSString *documentsDirectory = [paths objectAtIndex:0];   
		NSString *filepath = [documentsDirectory stringByAppendingPathComponent:@"data.txt"];  
		
		NSLog(filepath);
		
		// create a blank file, overwrite, if exists
		[[NSFileManager defaultManager] createFileAtPath:filepath contents:[NSData data] attributes:nil];
		
		// get a handle to the file
		NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:filepath];
		
		
		line = [NSString stringWithFormat:@" X Axis     Y Axis     Z Axis\n", nil];
		//			NSLog(@"Display x, y, z is: %f, %f, %f",  records[i][0], records[i][1], records[i][2]);			
		lineAsData = [line dataUsingEncoding:NSUTF8StringEncoding];
		[fileHandle writeData:lineAsData];		

[fileHandle closeFile];
If you guys have any suggestions or ideas, that would be appreciated and grateful.

Thank you
schem001 is offline   Reply With Quote
Old 05-25-2010, 05:03 PM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2010
Location: Issaquah, WA
Age: 42
Posts: 1,244
dljeffery is on a distinguished road
Default

Your NSLog output and code don't quite match up.

What is the return value from createFileAtPath? Also, what about the return value from fileHandleForWritingAtPath? (I would suspect it is nil.)

Also, I'd try skipping the two step method of creating/writing and just call the NSData instance method writeToFile:atomically: from your NSString's data, since you're not doing anything like appending to existing file contents.
__________________
Recall It! Tag your notes. Tag your photos. Tag your thoughts. Tag your life.

Recall It! for iPad

http://www.dljeffery.com
dljeffery is offline   Reply With Quote
Old 05-25-2010, 07:47 PM   #3 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 12
schem001 is on a distinguished road
Default

Quote:
Originally Posted by dljeffery View Post
Your NSLog output and code don't quite match up.

What is the return value from createFileAtPath? Also, what about the return value from fileHandleForWritingAtPath? (I would suspect it is nil.)

Also, I'd try skipping the two step method of creating/writing and just call the NSData instance method writeToFile:atomically: from your NSString's data, since you're not doing anything like appending to existing file contents.
Thanks for the reply.

What do you mean they do not match up? I just did my NSLOG to see where the file is stored, which shows that it is under /var/mobile/....... but i just cant find it.

Concerning creating/writing, shouldn't i be getting at least an empty output file even without including that, I mean by just doing:

Code:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);   
NSString *documentsDirectory = [paths objectAtIndex:0];   
NSString *filepath = [documentsDirectory stringByAppendingPathComponent:@"data.txt"];
I tried just that and still didnt output a file for me.

Any suggestions anybody. Txs
schem001 is offline   Reply With Quote
Reply

Bookmarks

Tags
identifier, load, path, save, store

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: 315
10 members and 305 guests
ajay123123, ashaman64, baja_yu, ChrisYates, guusleijsten, HemiMG, newDev, pkIDSF, Sami Gh, Steven.C
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,113
Posts: 402,878
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

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