I'm implementing the following function on appdelegate
,
but I need to write NSString
type instead of typical float values.
Since xcode doesn't allow an object to be in my desired position,
I used char*
instead as follows, where as my data to be passed are of type NSString
.
As expected, it doesn't work...
How could I manipulate it so that I could write NSString
data type?
Should I make some conversion?
Please help me out..
- (void)addHallOfFamer:(char*)newHofer{
[hofArray addObject:[NSString stringWithFormat:@"%@",newHofer]];
[hofArray sortUsingSelector:@selector(compare:)];
NSArray* paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsDirectory = [paths objectAtIndex:0];
NSString* hofArrayPath = [documentsDirectory
stringByAppendingPathComponent:@"hofers.plist"];
[hofArray writeToFile:hofArrayPath atomically:YES];
}
(added) following is how I'm calling the written NSStrings from another view, which doesn't reflect my updating.
MainAppDelegate* delegate;
delegate = (MainAppDelegate*)[[UIApplication sharedApplication] delegate];
NSArray *hofers = [[delegate.hofArray reverseObjectEnumerator] allObjects];
hoferName1.text = [NSString stringWithFormat:@"%@",[hofers objectAtIndex:0]];