Hi All,
I am completely newbee in objective c. I am trying to create property lists by reading a xml file using xml parser. works fine untill here.
But when i try to create a propertylist from this array that is holding the values i get the property list with empty data.
here is the code
Code:
- (void)viewDidLoad {
[super viewDidLoad];
// Uncomment the following line to add the Edit button to the navigation bar.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
appDelegate = (XMLAppDelegate *)[[UIApplication sharedApplication] delegate];
kal = [[NSMutableDictionary alloc] init];
int count = [appDelegate.books count];
Book *aBook;
for(int i = 0; i<count; i++)
{
aBook = [appDelegate.books objectAtIndex:i];
kal2 = [NSDictionary dictionaryWithObjectsAndKeys:aBook.letters,@"letter",
aBook.word,@"word",
aBook.origin,@"origin",
aBook.grammatical,@"grammatical",
aBook.meaning,@"meaning",nil];
[kal setObject:kal2 forKey:aBook.word];
NSLog(aBook.word);
NSLog(aBook.meaning);
[kal2 release];
[kal retain];
}
if([kal writeToFile:@"/Users/sk/Documents/urdudictionary" atomically:false])
{
NSLog(@"Success");
}
else
{
NSLog(@"Failure");
}