views:

29

answers:

1

I'm trying to save the kABFirstNamePropert, kABLastNameProperty and kABAddressProperty all saved into an array for recall later, I'm just not getting it, can anyone lend me a hand or point me in the right direction? Thanks. I'm a super NOOb on this.

For the naming the strings:

// setting the first name
firstName.text = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);

// setting the last name
lastName.text = (NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);

For setting the addressLabel:

NSString *address;
    address = [NSString stringWithFormat:@"%@, %@, %@, %@ %@",
               [theDict objectForKey:(NSString *)kABPersonAddressStreetKey],
               [theDict objectForKey:(NSString *)kABPersonAddressCityKey],
               [theDict objectForKey:(NSString *)kABPersonAddressStateKey],
               [theDict objectForKey:(NSString *)kABPersonAddressZIPKey],
               [theDict objectForKey:(NSString *)kABPersonAddressCountryKey]];

    self.addressLabel.text = address;

Saving the Array: What I have that's not working. ;(

- (IBAction)saveData {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *recipient = [NSString stringWithFormat:@"%@/arraySaveFile", documentsDirectory];

    NSMutableArray *array = [[NSMutableArray alloc] init];
    [array addObject:firstName];
    [array addObject:lastName];
    [array addObject:addressLabel];

    [array writeToFile:recipient atomically:NO];

}
A: 

This:

[array addObject:firstName]; 

needed to be:

[array addObject:firstName.text];

Thanks Everyone.

Michael Robinson