apphud / ApphudSDK-Flutter

MIT License
5 stars 5 forks source link

app crashes when using in_app_purchase plugin with apphud plugin in observer mode #34

Closed gidrokolbaska closed 2 years ago

gidrokolbaska commented 2 years ago

Hi! Can anyone please help me to discover what is wrong with my implementation? Issue description:

Could you please tell what kind of information do you want me to provide?

Here is the crash report
``` 2022-08-23 13:29:04.347954+0300 Runner[44188:318583] -[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x1061e9ea0 2022-08-23 13:29:04.353486+0300 Runner[44188:318583] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x1061e9ea0' *** First throw call stack: ( 0 CoreFoundation 0x0000000105ecbd70 __exceptionPreprocess + 236 1 libobjc.A.dylib 0x000000010543614c objc_exception_throw + 56 2 CoreFoundation 0x0000000105edb2f4 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0 3 CoreFoundation 0x0000000105ecffe0 ___forwarding___ + 1440 4 CoreFoundation 0x0000000105ed207c _CF_forwarding_prep_0 + 92 5 libswiftCore.dylib 0x0000000107131b40 $ss22_withCocoaASCIIPointer33_0E94757DB95241C9EB496742C81252F3LL_20requireStableAddress4workxSgyXl_SbAESPys5UInt8VGXEtlFAH_Tg5 + 56 6 libswiftCore.dylib 0x0000000107131cf0 $ss18_bridgeCocoaStringys01_C4GutsVyXlF + 148 7 libswiftCore.dylib 0x0000000107131ed0 $sSS12_cocoaStringSSyXl_tcfC + 24 8 libswiftFoundation.dylib 0x0000000108c6e024 $sSS10FoundationE36_unconditionallyBridgeFromObjectiveCySSSo8NSStringCSgFZ + 32 9 ApphudSDK 0x0000000105538808 $s9ApphudSDK0A15StoreKitWrapperC12paymentQueue_19updatedTransactionsySo09SKPaymentG0C_SaySo0J11TransactionCGtFyyScMYccfU_ + 808 10 ApphudSDK 0x00000001054a6178 $sIeg_IeyB_TR + 52 11 libdispatch.dylib 0x000000010af7033c _dispatch_call_block_and_release + 24 12 libdispatch.dylib 0x000000010af71b94 _dispatch_client_callout + 16 13 libdispatch.dylib 0x000000010af80650 _dispatch_main_queue_drain + 1064 14 libdispatch.dylib 0x000000010af80218 _dispatch_main_queue_callback_4CF + 40 15 CoreFoundation 0x0000000105e39c2c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 16 CoreFoundation 0x0000000105e340b0 __CFRunLoopRun + 2432 17 CoreFoundation 0x0000000105e33218 CFRunLoopRunSpecific + 572 18 GraphicsServices 0x00000001112df60c GSEventRunModal + 160 19 UIKitCore 0x000000011866da98 -[UIApplication _run] + 992 20 UIKitCore 0x0000000118672634 UIApplicationMain + 112 21 Runner 0x0000000104c15fd8 main + 64 22 dyld 0x0000000104e39cd8 start_sim + 20 23 ??? 0x000000010502d0f4 0x0 + 4379037940 24 ??? 0x1a01000000000000 0x0 + 1873778919962836992 ) libc++abi: terminating with uncaught exception of type NSException dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/gidrokolbaska/Library/Developer/Xcode/DerivedData/Runner-hipkfdxbfcuskabsvjnqmzuvohpx/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/gidrokolbaska/Library/Developer/Xcode/DerivedData/Runner-hipkfdxbfcuskabsvjnqmzuvohpx/Build/Products/Debug-iphonesimulator *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x1061e9ea0' terminating with uncaught exception of type NSException CoreSimulator 802.6.1 - Device: iPhone 12 (EDA37205-0365-4615-AA86-9AB9361D8087) - Runtime: iOS 15.5 (19F70) - DeviceType: iPhone 12 ```

Minimal reproduction steps:

alien190 commented 2 years ago

Hey, we have fixed this issue in 2.2.6. It was on Flutter’s InAppPurchasePlugin side, which was setting NSNull to an object of String type (applicationUsername to be exact). We made a workaround by simply avoiding accessing it https://github.com/apphud/ApphudSDK/commit/9217783cfdc19c29cc5b82b6c07659ec6df899cd#diff-390564d5ff67291b4606e23d8[…]6948c660ead1d61735538bfbdb9R117](https://github.com/apphud/ApphudSDK/commit/9217783cfdc19c29cc5b82b6c07659ec6df899cd#diff-390564d5ff67291b4606e23d801e5044ff6856948c660ead1d61735538bfbdb9R117)

gidrokolbaska commented 2 years ago

Awesome! It works now :) Tyvm, closing the issue