Ink / ios-picker

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

Request: Add error property to FPMediaInfo #119

Open newyorkpizza opened 8 years ago

newyorkpizza commented 8 years ago

If an error occurs during media upload, there is no direct way for my app to detect that an error has occurred.

Instead, we infer that an error has occurred by checking the info parameter for the delegate method - (void)fpPickerController:(FPPickerController *)picker didFinishPickingMediaWithInfo:(FPMediaInfo *)info. If info.remoteURL, info.filename, or info.mediaType is nil, then we know that the upload was unsuccessful.

However, it would be cleaner if the FilePicker API were to explicitly indicate that an error has occurred. It would also be useful if the API returned the NSError.

A possible solution would be to add a new property to FPMediaInfo for an NSError. Then, the connection error could be set on mediaInfo, i.e.:

    mediaInfo.error = error;
    failure(error, mediaInfo);

at these two lines: https://github.com/Ink/ios-picker/blob/a6357f33ea96d85360df4c2f4d1124f596e287cd/FPPicker/Platforms/iOS/FPLocalController.m#L681 https://github.com/Ink/ios-picker/blob/a6357f33ea96d85360df4c2f4d1124f596e287cd/FPPicker/Platforms/iOS/FPLocalController.m#L723