0
我試圖讓從NSURLConnection
委託加載對象數組返回給調用它的實現代碼如下JSON數據。傳遞一個NSArray作爲參數?
的委託對象與callback
初始化傳送回
NSArray *returnArray;
ResultsTableRoot *callback;
JSON處理方法
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
[connection release];
NSString *responseString = [[NSString alloc] initWithData:responseData
encoding:NSUTF8StringEncoding];
[responseData release];
NSError *error;
SBJSON *json = [[[SBJSON alloc] init] autorelease];
returnArray = [json objectWithString:responseString
error:&error];
[responseString release];
//////////////////////////////////////////////
// Send data back to table view
[callback resultsArrayReciever:returnArray];
}
的陣列不能從這裏訪問的實現代碼如下我想有信息,然而該方法被稱爲
-(void)resultsArrayReciever:(NSArray *)array {
// Code executed
if(array) {
// Code never executes, array isnt there
}
}
如果喲你有更好的方式去做這件事,它不僅僅是歡迎!