(kann nicht einen Weg finden, um einen Kommentar ...)
Ich bin hier das gleiche Problem haben und versucht, diesen Ansatz. Habe die appRecords mit removeAllObjects gelöscht, aber beim zweiten Mal funktioniert alles für die Artikel, aber die Icons werden nicht geladen.
Sie können das Problem reproduzieren, indem die ursprüngliche Beispielcode auf diese Weise zu ändern:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{ // konfigurieren und zeigen das Fenster [Fenster addSubview: [self.navigationController Ansicht]]; [Fenster makeKeyAndVisible];
// Initialize the array of app records and pass a reference to that list to our root view controller
self.appRecords = [NSMutableArray array];
rootViewController.entries = self.appRecords;
// NSURLRequest * urlRequest = [NSURLRequest requestWithURL: [NSURL URLWithString: TopPaidAppsFeed]]; //self.appListFeedConnection = [[[NSURLConnection-Zuordnung] initWithRequest: urlRequest-Delegat: self] autorelease];
// Test the validity of the connection object. The most likely reason for the connection object
// to be nil is a malformed URL, which is a programmatic error easily detected during development
// If the URL is more dynamic, then you should implement a more flexible validation technique, and
// be able to both recover from errors and communicate problems to the user in an unobtrusive manner.
//
//NSAssert(self.appListFeedConnection != nil, @"Failure to create URL connection.");
// show in the status bar that network activity is starting
// [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[self reloadData];
}
- (IBAction) Reload: (id) sender { [self reload]; }
- (void) {reload NSLog (@ "Aktualisieren von Einträgen"); [self.appRecords removeAllObjects]; // [[myTableViewController imageDownloadsInProgress] removeAllObjects];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:TopPaidAppsFeed]];
self.appListFeedConnection = [[[NSURLConnection alloc] initWithRequest:urlRequest delegate:self] autorelease];
// Test the validity of the connection object. The most likely reason for the connection object
// to be nil is a malformed URL, which is a programmatic error easily detected during development
// If the URL is more dynamic, then you should implement a more flexible validation technique, and
// be able to both recover from errors and communicate problems to the user in an unobtrusive manner.
//
NSAssert(self.appListFeedConnection != nil, @"Failure to create URL connection.");
// show in the status bar that network activity is starting
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
Hallo Ryan, danke für die Antwort. Ich habe das versucht und ich verstehe, dass dies die Hauptidee ist, aber es stürzt ab, und das Ändern von handleLoadedApps zum Löschen der Objekte verhindert, dass der RSS-Feed anfänglich geladen wird. Jede weitere Anleitung würde sehr geschätzt werden. – Hanson
Das Ändern von 'rootViewController.entries = [NSArray array];' to '[rootViewController.imageDownloadsInProgress removeAllObjects]; in' handleLoadedApps' scheint für mich zu funktionieren. In meinem Fall erstelle ich eine neue 'NSURLConnection' in' ApplicationWillEnterForeground' – MrDatabase