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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 07-27-2010, 11:54 AM   #2 (permalink)
Duncan C
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 4,813
Default

Oops. I was missing an allocate of the values array. Try this:


Code:
- (void)viewDidLoad {
	NSString *myPath = [self saveFilePath];
	NSString *test = @"Code";
	NSArray *fileArray = [[NSArray alloc] initWithContentsOfFile:myPath];
	NSMutableArray* values = [NSMutableArray arrayWithCapacity: [fileArray count] +1];
	[values addObjectsFromArray: fileArray];
	[fileArray release];
	[values addObject:test];   
	[values writeToFile:[self saveFilePath] atomically:YES];

	[super viewDidLoad];
}

In that code, we create a new mutable copy of the array, sizing it to hold one more object than the array read from the file.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.

Last edited by Duncan C; 07-27-2010 at 01:20 PM.
Duncan C is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,852
Threads: 89,216
Posts: 380,667
Top Poster: BrianSlick (7,129)
Welcome to our newest member, syrreintyia1
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:00 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.