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-10-2010, 08:31 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 2
driano is on a distinguished road
Default plist problem

I have a plist, where i have one dict with group (string) and records (array)


Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
	<dict>
		<key>group</key>
		<string>Home to Girlfriend</string>
		<key>records</key>
		<array>
			<dict>
				<key>date</key>
				<string>24/08/2010</string>
				<key>time</key>
				<string>00:33:04</string>
			</dict>
		</array>
	</dict>
</array>
</plist>
I want to add new group, and this make a records empty to be add records lately.

I make a code to add group and add records (array) empty.
But when i go to save records in this new group, it can't save.

My code to save a record, is just ok when a category that was previously created with some records itens.


This is the code to add new group!
Code:
-(IBAction)saveGroup {
	
	nomeDoGrupo = nameGroup.text; 

	NSArray* meuArrayRecords;
	meuArrayRecords = [NSArray arrayWithObjects: nil]; 
	
    NSDictionary* novoGroup = [NSDictionary dictionaryWithObjectsAndKeys:
								 nomeDoGrupo, @"group",
							     meuArrayRecords, @"records",
								 nil];

    [recordsArray addObject:novoGroup];
    
    [recordsArray writeToFile:recordsArrayPath atomically:YES];
    
    [self dismissModalViewControllerAnimated:YES];
	
	
}

This is the part of code to save records to a group
Code:
NSDictionary* meuGroupDict = groupDict;
	NSMutableArray* meusRecordsArray = [meuGroupDict objectForKey:@"records"];
    
    NSDictionary* novoRecords = [NSDictionary dictionaryWithObjectsAndKeys:
							   tempoString, @"time",
                               hoje, @"date",
                               nil];
    
    
    [meusRecordsArray addObject:novoRecords];
    
    [recordsArray writeToFile:recordsArrayPath atomically:YES];
    
    [self dismissModalViewControllerAnimated:YES];

Can anyone help me?
Sorry for the english, i'm brazilian
driano is offline   Reply With Quote
Old 09-10-2010, 04:45 PM   #2 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 2
driano is on a distinguished road
Default

I resolve it ;D

reloading plist before write...
driano 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: 329
10 members and 319 guests
bignoggins, carlandrews, flamingliquid, hzwegjxg, ilmman, jenniead38, linkmx, nadav@webtview.com, stanny
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:51 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0