小编sky*_*sky的帖子

EXC_BAD_ACCESS错误

我创建了一个应该运行的应用程序,直到我停止它.它基本上做的是从连接的另一个设备获取一些数据NSURLConnection,并定期使用该数据发送到服务器,并定期从服务器读取数据,并使用图形将该数据可视化NSXMLParser.

我运行仪器来检查分配和泄漏.完全没有泄漏.内存监视器显示一致的5.2 MB.Objectalloc图是稳定的,objectallo的净字节是480000,#net是6400左右.

它在大约10~15小时后坠毁.所以我添加了断点malloc_error_break.现在,EXC_BAD_ACCESS大约12小时后,我在调试器控制台上出现" "错误.

任何的想法?

一个可疑的部分是SENDING数据.


- (void) sendDataToServerWithX:(float)x Y:(float)y{ 
NSAutoreleasePool *uiUpdatePool = [[NSAutoreleasePool alloc] init]; 
NSString *urlString = [[NSString alloc] initWithFormat:@"http://www.url.com/save_data.php?user=user1&x=%f&y=%f", x, y];
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:urlString] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) { NSLog(@"sending success"); } //else { }

NSLog( @"data sent.");
[urlString release];
[theConnection release]; [uiUpdatePool drain]; }

另一个可疑部分是阅读数据:


- (void) readCurrentDataFromServer: (NSTimer *) timer {
NSAutoreleasePool *uiUpdatePool = …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c

2
推荐指数
1
解决办法
8560
查看次数

标签 统计

cocoa-touch ×1

iphone ×1

objective-c ×1