I upload photos, and sometimes there will be exc_bad_access error, causing the program to crash.
I've added a NSZombieEnabled, but it seems useless (plus go after the Internet that can be immediately stopped in the wrong place).
Here is my wrong place, pointing my big brother looking to do. Thank
(Lldb) bt
* Thread # 1: tid = 0x2403, 0x34f11d44 CFNetwork `_WriteCommand (_CFFTPNetConnectionContext *, _CFFTPStreamContext *, __ CFString const *) + 64, stop reason = EXC_BAD_ACCESS (code = 1, address = 0x30)
frame # 0: 0x34f11d44 CFNetwork `_WriteCommand (_CFFTPNetConnectionContext *, _CFFTPStreamContext *, __ CFString const *) + 64
frame # 1: 0x34f11eae CFNetwork `_StartProcess (_CFFTPNetConnectionContext *, _CFFTPStreamContext *) + 226
frame # 2: 0x34f11850 CFNetwork `_FTPConnectionRequestStateChanged (_CFFTPStreamContext *, NetConnection :: State, CFStreamError *, NetConnection_Classic *, _CFFTPNetConnectionContext *) + 112
frame # 3: 0x34f38cb4 CFNetwork `NetConnection_Classic :: requestStateChanged (void *, NetConnection :: State, CFStreamError *) + 28
frame # 4: 0x34ee9004 CFNetwork `NetConnection :: enqueue (void *, unsigned char) + 320
frame # 5: 0x34f0f2f2 CFNetwork `_FTPStreamOpen (void const *, CFStreamError *, unsigned char *, _CFFTPStreamContext *) + 3418
frame # 6: 0x34f7fa90 CFNetwork `CoreWriteStreamWithCallbacks :: _streamImpl_Open (CFStreamError *, unsigned char *) + 40
frame # 7: 0x34f7fb82 CFNetwork `non-virtual thunk to CoreWriteStreamWithCallbacks :: _streamImpl_Open (CFStreamError *, unsigned char *) + 10
frame # 8: 0x34f801b4 CFNetwork `CoreStreamBase :: _streamInterface_Open () + 44
frame # 9: 0x34f7f5a4 CFNetwork `CoreStreamCFStreamSupport <__CFWriteStream*, CoreWriteStream> :: _stream_open (__CFWriteStream *, CFStreamError *, unsigned char *, void *) + 40
frame # 10: 0x3792f3f6 CoreFoundation `_CFStreamOpen + 74
frame # 11: 0x3792f3a6 CoreFoundation `CFWriteStreamOpen + 90
frame # 12: 0x000a11ec racing game `- [FTPUpload sendAction:] (self = 0x0772e000, _cmd = 0x000a6fc8, sender = 0x1eace9d0) + 892 at FTPUpload.m: 81
frame # 13: 0x000a0a3a racing game `- [CamViewController creatDirect:] (self = 0x1d5a6220, _cmd = 0x000a6eb3, img = 0x1eacce10) + 558 at CamViewController.m: 161
frame # 14: 0x000a07b0 racing game `__33-[CamViewController Captureimage] _block_invoke (, imageSampleBuffer = 0x1eacc850, error = 0x00000000) + 236 at CamViewController.m: 142
frame # 15: 0x385b4ed4 AVFoundation `- [AVCaptureStillImageOutput handleNotification: payload:] + 348
frame # 16: 0x385aad5a AVFoundation `avcaptureSessionFigRecorderNotification + 466
frame # 17: 0x385ccd92 AVFoundation `AVCMNotificationDispatcherCallback + 190
frame # 18: 0x379a8e24 CoreFoundation `__CFNotificationCenterAddObserver_block_invoke_0 + 124
frame # 19: 0x3792d036 CoreFoundation `_CFXNotificationPost + 1426
frame # 20: 0x3792e610 CoreFoundation `CFNotificationCenterPostNotification + 104
frame # 21: 0x3865dc8a CoreMedia `CMNotificationCenterPostNotification + 118
frame # 22: 0x3576ef36 Celestial `remoteRecorder_PostPhotoNotification + 514
frame # 23: 0x3574be76 Celestial `FigRecorderRemoteCallbacksServer_NotificationIsPending + 1270
frame # 24: 0x3574b97a Celestial `_XNotificationIsPending + 70
frame # 25: 0x3574b92e Celestial `figrecordercallbacks_server + 98
frame # 26: 0x3574b17c Celestial `remrec_ClientPortCallBack + 176
frame # 27: 0x379a65da CoreFoundation `__CFMachPortPerform + 118
frame # 28: 0x379b1172 CoreFoundation `__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
frame # 29: 0x379b1116 CoreFoundation `__CFRunLoopDoSource1 + 138
frame # 30: 0x379aff98 CoreFoundation `__CFRunLoopRun + 1384
frame # 31: 0x37922ebc CoreFoundation `CFRunLoopRunSpecific + 356
frame # 32: 0x37922d48 CoreFoundation `CFRunLoopRunInMode + 104
frame # 33: 0x367592ea GraphicsServices `GSEventRunModal + 74
frame # 34: 0x38ef42f8 UIKit `UIApplicationMain + 1120
frame # 35: 0x000556ec racing game `main (argc = 1, argv = 0x2fdacc20) + 116 at main.m: 16
frame # 36: 0x34dd1b20 libdyld.dylib `start + 4
(Lldb)
Code:
NSURL * url ;/ / ftp server address
NSString * filePath ;/ / Image URL
NSString * account ;/ / account
NSString * password ;/ / password
CFWriteStreamRef ftpStream;
url = [NSURL URLWithString: _strServerIP];
NSLog (@ "FTP% @", _strServerIP);
filePath = sender;
account = _strAccount;
password = _strPassword;
url = [NSMakeCollectable (CFURLCreateCopyAppendingPathComponent (NULL, (CFURLRef) url, (CFStringRef) [filePath lastPathComponent], false)) autorelease];
self.fileStream = [NSInputStream inputStreamWithFileAtPath: filePath];
[Self.fileStream open];
ftpStream = CFWriteStreamCreateWithFTPURL (NULL, (CFURLRef) url);
self.networkStream = (NSOutputStream *) ftpStream;
[Self.networkStream setProperty: account forKey: (id) kCFStreamPropertyFTPUserName];
[Self.networkStream setProperty: password forKey: (id) kCFStreamPropertyFTPPassword];
self.networkStream.delegate = self;
/ / Set runloop
[Self.networkStream scheduleInRunLoop: [NSRunLoop currentRunLoop] forMode: NSDefaultRunLoopMode];
[Self.networkStream open];
Reply:
networkStream definition code Fangshanglai look
No comments:
Post a Comment