我使用下面的方法:
[filehandler writeData:[NSData dataWithBytesNoCopy:bytes length:size freeWhenDone:NO]];
filehandler是NSFileHandle,当我的手机在几秒钟后锁定值时Null和我的应用程序崩溃。
这是崩溃消息_:
[EXCEPTION] *** Terminating app due to uncaught exception 'NSFileHandleOperationException', reason: '*** -[NSConcreteFileHandle writeData:]: Operation not permitted'
*** Fragment of the call stack:
(
"4 libc++abi.dylib 0x1a6c398f <redacted> + 78",
"5 libc++abi.dylib 0x1a6c31a3 <redacted> + 0",
"6 libobjc.A.dylib 0x1a6cf139 <redacted> + 0",
"7 CoreFoundation 0x1b447a85 <redacted> + 0",
"8 Foundation 0x1bd3e1af <redacted> + 144",
"9 Foundation 0x1bd3ea5f <redacted> + 254",
"10 PrivateGSMEnt 0x0014acfb -[LogFileManager level:tagLevel:mainTag:append:] + 1070",
"11 PrivateGSMEnt 0x00067003 log_func + 996",
"12 PrivateGSMEnt 0x0046c451 log_writer + 166",
"13 PrivateGSMEnt 0x003dfb53 pj_log + 1284",
"14 PrivateGSMEnt 0x003dfdf7 pj_log_4 + 64",
"15 PrivateGSMEnt 0x003e0e97 replace_udp_sock + 170",
"16 PrivateGSMEnt 0x003e13f5 ioqueue_dispatch_read_event + 590",
"17 PrivateGSMEnt 0x003e32ef pj_ioqueue_poll + 898",
"18 PrivateGSMEnt 0x003f47d5 worker_proc + 84",
"19 PrivateGSMEnt 0x003de4c7 thread_main + 146",
"20 libsystem_pthread.dylib 0x1accc93b <redacted> + 216",
"21 libsystem_pthread.dylib 0x1accc85d _pthread_start + 234",
"22 libsystem_pthread.dylib 0x1acca468 thread_start + 8"
)
libc++abi.dylib: terminating with uncaught exception of type NSException
有什么想法吗?