我試圖打印我用解析填充的數組的內容,但在函數之外數組爲空且打印爲空。我怎樣才能解決這個問題?感謝Array函數爲null
- (void) retrieveFromParse {
PFQuery *retrieveColors = [PFQuery queryWithClassName:@"Bracciali"];
[retrieveColors findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
NSArray *array = [objects objectAtIndex:0];//Selects the first "object" from all the "objects"
array = [array valueForKey:@"NomeDispositivo"];//Makes a NSArray from the "pairs" values
colorsArray = [array mutableCopy];//Converts the array to a NSMutableArray
NSLog(@"%@", colorsArray); // PRINT THE ARRAY,,,
}
}];
NSLog(@"%@", colorsArray); //PRINT NULL
}