Forum Xamarin Xamarin.Forms

Crash using Crossmedia Plugin to upload image

percepticonpercepticon USMember ✭✭

Dear Experts,

I'm using the Crossmedia plugin to upload a photo from my device's gallery to a server. Everything works fine the first time, meaning I get the dialog asking for permission and the upload actually happens. However, the very next time i attempt to upload a photo, it crashes. I believe I have the correct keys set in info.pList but haven't quite found a reason for it...Has anyone experienced this before?

Many thanks in advance!

percy

Answers

  • tareqelzoubitareqelzoubi Member ✭✭

    ... is there an exceptions ? error messages

  • percepticonpercepticon USMember ✭✭

    yes - apologies, just hoping there was a common occurrence and solution.

    2020-02-02 12:43:18.142785-0500 theapp.iOS[35915:4468768] Unable to save image with metadata: Foundation.MonoTouchException: Objective-C exception thrown. Name: NSUnknownKeyException Reason: [<__NSFrozenDictionaryM 0x6000074cd280> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Orientation.
    Native stack trace:
    0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
    1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
    2 CoreFoundation 0x00007fff23c70e49 -[NSException raise] + 9
    3 Foundation 0x00007fff25712ee3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 325
    4 theapp.iOS 0x0000000109baa6d9 xamarin_dyn_objc_msgSend + 217
    5 ??? 0x00000001119a6763 0x0 + 4590298979

    at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.17/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:406
    at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/runtime/Delegates.generated.cs:128
    at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr)
    at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr(intptr,intptr,intptr,intptr)
    at Foundation.NSObject.SetValueForKey (Foundation.NSObject value, Foundation.NSString key) [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.17/src/Xamarin.iOS/NSObject.g.cs:546
    at Plugin.Media.MediaPickerDelegate.SaveImageWithMetadata (UIKit.UIImage image, System.Single quality, Foundation.NSDictionary meta, System.String path) [0x0013b] in D:\a\1\s\src\Media.Plugin\iOS\MediaPickerDelegate.cs:520
    --- End of stack trace from previous location where exception was thrown ---

    at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr(intptr,intptr,intptr,intptr)
    at Foundation.NSObject.SetValueForKey (Foundation.NSObject value, Foundation.NSString key) [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.17/src/Xamarin.iOS/NSObject.g.cs:546
    at Plugin.Media.MediaPickerDelegate.SaveImageWithMetadata (UIKit.UIImage image, System.Single quality, Foundation.NSDictionary meta, System.String path) [0x0013b] in D:\a\1\s\src\Media.Plugin\iOS\MediaPickerDelegate.cs:520 0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
    1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
    2 CoreFoundation 0x00007fff23c70e49 -[NSException raise] + 9
    3 Foundation 0x00007fff25712ee3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 325
    4 theapp.iOS 0x0000000109baa6d9 xamarin_dyn_objc_msgSend + 217
    5 ??? 0x00000001119a6763 0x0 + 4590298979

    Thanks!

  • ColeXColeX Member, Xamarin Team Xamurai

    This is a general issue , can you clarify which line caused the error ?

  • percepticonpercepticon USMember ✭✭

    @ColeX - Thanks, It's hard to say exactly because by the time it crashes i've actually selected the image and immediately get the exception above. The first line of the exception is "Unable to save image with metadata" - so it's had to tell since it's a runtime issue and everything is happening behind the scenes at that point.

    regards

    percy

  • ColeXColeX Member, Xamarin Team Xamurai

    Could you provide us a basic ,mini project to test ?

    You could also raise issue here for better support : https://github.com/jamesmontemagno/MediaPlugin/issues.

  • percepticonpercepticon USMember ✭✭

    Turns out I need to set SaveMetaData to false in PickMediaOptions for future reference.

    cheers

  • ColeXColeX Member, Xamarin Team Xamurai

    @percepticon said:
    Turns out I need to set SaveMetaData to false in PickMediaOptions for future reference.

    cheers

    Please mark solution as answer .

Sign In or Register to comment.