clippings is an ivar declared as a pointer to an NSMutableArray.
Here's the code in -(void)viewWillAppearBOOL)animated
And the output that is logged is:
What am I doing wrong here? I know that [UIPasteboard generalPasteboard].string is not nil, because it's displaying what's on that paste board in a UILabel elsewhere in my program.
Here's the code in -(void)viewWillAppearBOOL)animated
Code:
clippings = [[[[NSUserDefaults standardUserDefaults] arrayForKey:@"clippings"] mutableCopy] retain];
if ([clippings count] == 0) [clippings addObject:[UIPasteboard generalPasteboard].string];
else [clippings insertObject:[UIPasteboard generalPasteboard].string atIndex:0];
NSLog(@"Added an object to clippings.");
NSLog(@"Number of clippings: %i", [clippings count]);
And the output that is logged is:
Added an object to clippings.
Number of clippings: 0
What am I doing wrong here? I know that [UIPasteboard generalPasteboard].string is not nil, because it's displaying what's on that paste board in a UILabel elsewhere in my program.