2
的didReceiveData方法奇怪的问题,我在植入简单NSURLConnection的得到了这个奇怪的问题......与appendData在NSURLConnection的
的方法didReceiveData获得打电话,我高兴地试图追加接收数据,但...虚无缥缈!
有是肯定的一些数据(如长度指示,但appendData没有附加数据!
我开始砰我的头就这一个,我需要一些帮助,它的后期:-)
前这里是一些代码来看看:
我的头......
@interface ActionViewController : UITableViewController {
Site *site;
NSURLConnection *siteConnection;
NSMutableData *receivedData;
UIView *waitView;
UIActivityIndicatorView *activityIndicator;
int nConnections;
BOOL fail;
}
我的实现..
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
// Append the new data to receivedData.
NSLog(@"Received %d bytes of data",[data length]);
[receivedData appendData:data];
NSLog(@"Received %d bytes of data",[receivedData length]);
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(@"Succeeded! Received %d bytes of data",[receivedData length]);
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
[activityIndicator stopAnimating];
waitView.hidden = YES;
// release the connection
[connection release];
}
控制台输出...
[Session started at 2010-08-21 21:27:55 -0400.]
2010-08-21 21:28:19.263 myApp[2042:207] Received 108 bytes of data
2010-08-21 21:28:19.263 myApp[2042:207] Received 0 bytes of data
2010-08-21 21:28:19.263 myApp[2042:207] Succeeded! Received 0 bytes of data
我不明白这一点!帮帮我!!!
BTW,该数据是一个简单的XML结果是这个样子......
<donnee>0</donnee><donnee>0</donnee><donnee>0</donnee><donnee>1</donnee><donnee>0</donnee><donnee>0</donnee>
谢谢,这个同样的问题正在导致我死亡。 – cksubs 2011-12-02 05:22:42
啊另一个例子就是我的爱与恨的关系与iOS的悄然失败的方式。这里没什么可看的,这些不是你要找的机器人。 – Rydell 2013-02-02 21:59:37