我试图用手写一个文件,因为它在撰写报告时冻结了我的照片,但当发射文件时,它坠毁。
2011-10-04 21:53:51.022 xxxxxxxxx[2046:6603] *** Terminating app due to uncaught exception NSFileHandleOperationException , reason: *** -[NSConcreteFileHandle seekToEndOfFile]: Operation timed out
我的法典:
- (void)WriteTest{
[NSThread detachNewThreadSelector:@selector(DoWriteTest:) toTarget:self withObject:hFile];
}
- (void)DoWriteTest:(NSFileHandle *)aHandle{
int i;
if (aHandle) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"---start--- writing test file --");
for (i=0; i<1024*1024; i++) {
[aHandle seekToEndOfFile];
[aHandle writeData:[NSData dataWithBytes:bytes length:(sizeof bytes) - 1]];
usleep(1);
}
NSLog(@"---end--- writing test file");
[pool release];
} else {
NSLog(@"ERROR: writing test file thread");
}
}
如果这行不通,那么你可以解释一下什么错了,那就做了很多的索戈,但找不到解决办法。 感谢。