Looking at this code (ARC turned on):
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString {
dispatch_queue_t fetchDataQueue = dispatch_queue_create("Fetch Data Queue", nil);
dispatch_async(fetchDataQueue, ^{
NSArray *temp = [Product retrieveProductsByName:searchString];
dispatch_async(dispatch_get_main_queue(), ^{
_products = [temp copy];
[controller.searchResultsTableView reloadData];
});
});
dispatch_release(fetchDataQueue);
return NO;
}
Is it really safe? Is my temp NSArray going to be automatically released?
Yes, if you have ARC on that will be done automatic. And of course Mac OS X is a modern System and normally all your objects will be released if your app terminates.