Ink / ios-picker

[DEPRECATED] The easiest way to import content into your application. http://filepicker.io
MIT License
226 stars 78 forks source link

Crash in v5.1.1 in +[FPUtils UTIForMimetype:] #117

Closed newyorkpizza closed 8 years ago

newyorkpizza commented 8 years ago

We've seen some crashes with these details.

Exception description:

Fatal Exception: NSInvalidArgumentException
-[NSNull length]: unrecognized selector sent to instance 0x38fa6e48

Crash reason:

SIGABRT ABORT 0x00000000361d8c84

Stack trace:

Thread : Fatal Exception: NSInvalidArgumentException

0  CoreFoundation                 0x23db567b __exceptionPreprocess
1  libobjc.A.dylib                0x3599ae17 objc_exception_throw
2  CoreFoundation                 0x23dbae95 __methodDescriptionForSelector
3  CoreFoundation                 0x23db8ac9 ___forwarding___
4  CoreFoundation                 0x23ce9128 _CF_forwarding_prep_0
5  MobileCoreServices             0x25e7daf5 (Missing)
6  MobileCoreServices             0x25eb414f (Missing)
7  MobileCoreServices             0x25eb5d77 (Missing)
8  MobileCoreServices             0x25eb41cd (Missing)
9  newyorkpizza                   0x2ada47 +[FPUtils UTIForMimetype:] (FPUtils.m:276)
10 newyorkpizza                   0x2a6e9b -[FPSourceController fetchObject:withThumbnail:success:failure:progress:] (FPSourceController.m:1210)
11 newyorkpizza                   0x2a63af -[FPSourceController fileSelectedAtIndex:forView:withThumbnail:] (FPSourceController.m:1156)
12 newyorkpizza                   0x2a5eb7 -[FPSourceController objectSelectedAtIndex:forView:withThumbnail:] (FPSourceController.m:1060)
13 newyorkpizza                   0x2a5d87 -[FPSourceController objectSelectedAtIndex:forView:] (FPSourceController.m:1034)
14 newyorkpizza                   0x2a3905 -[FPSourceController tableView:didSelectRowAtIndexPath:] (FPSourceController.m:548)
15 UIKit                          0x27fd7487 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:]
16 UIKit                          0x2809240b -[UITableView _userSelectRowAtPendingSelectionIndexPath:]
17 UIKit                          0x2814a0b9 _runAfterCACommitDeferredBlocks
18 UIKit                          0x281559eb _cleanUpAfterCAFlushAndRunDeferredBlocks
19 UIKit                          0x27e97ecd _afterCACommitHandler
20 CoreFoundation                 0x23d784c9 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
21 CoreFoundation                 0x23d767cd __CFRunLoopDoObservers
22 CoreFoundation                 0x23d76bff __CFRunLoopRun
23 CoreFoundation                 0x23cca119 CFRunLoopRunSpecific
24 CoreFoundation                 0x23cc9f05 CFRunLoopRunInMode
25 GraphicsServices               0x2ce67ac9 GSEventRunModal
26 UIKit                          0x27f0cf15 UIApplicationMain
27 newyorkpizza                   0x7c3bf main (main.m:16)
28 libdyld.dylib                  0x36109873 start

The source of the problem seems to be the JSON that is received in -[FPSourceController fpLoadResponseSuccessAtPath:withResult:]; at least one object in the contents array returns NSNull for its mimetype.

E.g. JSON[@"contents"][0][@"mimetype"] is equal to [NSNull null]. Could be a bug in the server since this SDK expects mimetype to always been a string.

newyorkpizza commented 8 years ago

Cool, thanks @dzana!