cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We want to hear from you on accessibility tools and features for Dropbox - get involved in the conversation here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: v2 API iOS Objective-C SDK: crash after file upload

v2 API iOS Objective-C SDK: crash after file upload

zulfishah
Explorer | Level 3

I'm getting a lot of crash reports after updating my app to the v2 API using the iOS Objective-C Dropbox library. The crash log seems to suggest something internal with the Dropbox library ... can someone take a look and verfiy what might be going wrong? The file seems to upload just fine, but the user gets a crash. 

 

 My code:

 

        DBFILESWriteMode *mode = [[DBFILESWriteMode alloc] initWithOverwrite];
        DBUploadTask *task = [self.restClientNew.filesRoutes uploadUrl:[NSString stringWithFormat:@"/ContactsJournal/FileAttachments/%@", [url lastPathComponent]] mode:mode autorename:@NO clientModified:[NSDate date] mute:@NO inputUrl: url];
        
        [task setResponseBlock:^(DBFILESFileMetadata *response, id  _Nullable routeError, DBRequestError * _Nullable error) {
            if (response) {
...

 

The crash report itself:

 

Exception Type:  SIGABRT
Exception Codes: #0 at 0x187429014
Crashed Thread:  0

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot read file at file:///private/var/mobile/Containers/Shared/AppGroup/31BB2FD4-C64D-4B54-BD8D-355637A6EC54/FileAttachments/Picture%20(09-18-2017%2015:21:53)-72550D2A-0EE6-4277-BAAA-9FA0D95E9F8C.pdf'

Last Exception Backtrace:
0   CoreFoundation                       0x000000018842efe0 __exceptionPreprocess + 124
1   libobjc.A.dylib                      0x0000000186e90538 objc_exception_throw + 52
2   CFNetwork                            0x0000000188b1eec8 -[__NSURLBackgroundSession validateUploadFile:] + 268
3   CFNetwork                            0x0000000188b1fd44 -[__NSURLBackgroundSession _onqueue_uploadTaskForRequest:uploadFile:bodyData:completion:] + 84
4   CFNetwork                            0x0000000188b1fbf8 __80-[__NSURLBackgroundSession uploadTaskForRequest:uploadFile:bodyData:completion:]_block_invoke + 36
5   CFNetwork                            0x0000000188b1f0fc __68-[__NSURLBackgroundSession performBlockOnQueueAndRethrowExceptions:]_block_invoke + 72
6   libdispatch.dylib                    0x00000001872e69a0 _dispatch_client_callout + 12
7   libdispatch.dylib                    0x00000001872f3ee0 _dispatch_barrier_sync_f_invoke + 80
8   CFNetwork                            0x0000000188b1f05c -[__NSURLBackgroundSession performBlockOnQueueAndRethrowExceptions:] + 148
9   CFNetwork                            0x0000000188b1fb58 -[__NSURLBackgroundSession uploadTaskForRequest:uploadFile:bodyData:completion:] + 200
10  ObjectiveDropboxOfficial             0x000000010060bc5c -[DBTransportDefaultClient requestUpload:arg:inputUrl:] (DBTransportDefaultClient.m:98)
11  ObjectiveDropboxOfficial             0x00000001006554f8 -[DBFILESRoutes uploadUrl:mode:autorename:clientModified:mute:inputUrl:] (DBFILESRoutes.m:768)
12  SimpleList-iPad                      0x00000001001968b4 -[DropboxNewManager uploadFilesToDropboxWithList:] (DropboxNewManager.m:781)
13  SimpleList-iPad                      0x00000001001963c4 -[DropboxNewManager startUploadFileAttachmentsToDropBox] (DropboxNewManager.m:732)
14  SimpleList-iPad                      0x000000010019629c -[DropboxNewManager handleUploadURLResponse:] (DropboxNewManager.m:714)
15  SimpleList-iPad                      0x0000000100195e44 __55-[DropboxNewManager saveChangesToDropBoxWithParentRev:]_block_invoke_2 (DropboxNewManager.m:669)
16  ObjectiveDropboxOfficial             0x000000010060f570 __46-[DBUploadTask storageBlockWithResponseBlock:]_block_invoke (DBTasks.m:180)
17  ObjectiveDropboxOfficial             0x000000010067919c -[DBDelegate URLSession:task:didCompleteWithError:] (DBDelegate.m:84)
18  CFNetwork                            0x0000000188c07ad4 __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke.185 + 68
19  Foundation                           0x0000000188efe854 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 12
20  Foundation                           0x0000000188e437b0 -[NSBlockOperation main] + 92
21  Foundation                           0x0000000188e33b68 -[__NSOperationInternal _start:] + 608
22  Foundation                           0x0000000188f00bf0 __NSOQSchedule_f + 224
23  libdispatch.dylib                    0x00000001872e69a0 _dispatch_client_callout + 12
24  libdispatch.dylib                    0x00000001872eb5e8 _dispatch_main_queue_callback_4CF + 992
25  CoreFoundation                       0x00000001883dd0c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
26  CoreFoundation                       0x00000001883dace4 __CFRunLoopRun + 1568
27  CoreFoundation                       0x000000018830ada4 CFRunLoopRunSpecific + 420
28  GraphicsServices                     0x0000000189d75074 GSEventRunModal + 96
29  UIKit                                0x000000018e5bec9c UIApplicationMain + 204
30  SimpleList-iPad                      0x00000001000bb850 main (main.m:20)
31  libdyld.dylib                        0x000000018731959c start + 0

Thread 0 Crashed:
0   libsystem_kernel.dylib               0x0000000187429014 __pthread_kill + 8
1   libsystem_pthread.dylib              0x00000001874f3264 pthread_kill + 108
2   libsystem_c.dylib                    0x000000018739d9c4 abort + 136
3   SimpleList-iPad                      0x00000001002b5268 uncaught_exception_handler + 28
4   CoreFoundation                       0x000000018842f354 __handleUncaughtException + 624
5   libobjc.A.dylib                      0x0000000186e90814 _objc_terminate() + 108
6   SimpleList-iPad                      0x00000001002a3084 BITCrashUncaughtCXXTerminateHandler() (BITCrashCXXExceptionHandler.mm:178)
7   libc++abi.dylib                      0x0000000186e7f5d4 std::__terminate(void (*)()) + 12
8   libc++abi.dylib                      0x0000000186e7f640 std::terminate() + 56
9   libdispatch.dylib                    0x00000001872e69b4 _dispatch_client_callout + 32
10  libdispatch.dylib                    0x00000001872eb5e8 _dispatch_main_queue_callback_4CF + 992
11  CoreFoundation                       0x00000001883dd0c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
12  CoreFoundation                       0x00000001883dace4 __CFRunLoopRun + 1568
13  CoreFoundation                       0x000000018830ada4 CFRunLoopRunSpecific + 420
14  GraphicsServices                     0x0000000189d75074 GSEventRunModal + 96
15  UIKit                                0x000000018e5bec9c UIApplicationMain + 204
16  SimpleList-iPad                      0x00000001000bb850 main (main.m:20)
17  libdyld.dylib                        0x000000018731959c start + 0
3 Replies 3

Greg-DB
Dropbox Staff

Thanks for the report! A few questions first:

 

- What version of the SDK are you using? If you're not using the latest version, currently v3.3.2, please update to that and let us know if it doesn't help.

- Are you able to reproduce this yourself, or are you only seeing it via user crash reports?

zulfishah
Explorer | Level 3
I'm only getting this through user crash reports; not reproducible myself (though I'm trying). Also trying to figure out which version of the SDK I currently have integrated in the project ... how would I be able to do that? I just imported the ObjectiveDropboxOfficial2.framework

Greg-DB
Dropbox Staff

As long as you have a copy from around March or later you can check the kV2SDKVersion constant in code.

 

Otherwise, it would depend on your installation method. E.g., with CocoaPods you can check the Podfile.lock file. For Carthage, you can check the Cartfile.resolved file.

Need more support?