Mac/iPhone 用の GData ObjC クライアントを介して Google スプレッドシートにアップロードするアプリがあります。そのままで問題なく動作します。独自のスレッドでアップロード部分を取得しようとしていますが、新しいスレッドでアップロード メソッドを呼び出そうとしています。
見て:
-(void)establishNewThreadToUpload {
[NSThread detachNewThreadSelector:@selector(uploadToGoogle) toTarget:self withObject:nil];
}
-(void)uploadToGoogle {
NSAutoReleasePool *pool = [[NSAutoReleasePool alloc] init];
//works fine
[helper setNewServiceWithName:username password:password];
//works fine
[helper fetchUserSpreadsheetFeed];
//inside the helper class, fetchUserSpreadsheet feed calls ANOTHER method, which
//calls ANOTHER METHOD and so on, until the object is either uploaded or fails
//However, once the class gets to the end of fetchUserSpreadsheetFeed
//control is passed back to this method, and
[pool release];
//is called. The thread terminates and nothing ever happens.
}
別のスレッドを使用することを忘れた場合、すべてが想定どおりに機能します。私はスレッド プログラミングに慣れていないので、不足しているものがあれば教えてください。
ありがとう!