expo: [iOS] Error within listeners in rn0.65
Summary
I assume unimodules are not supporting v0.65 of react native at this, time, but never the less though this issue could be useful. Something in 0.65 breaks initialisation of in app purchases and throws following error. My hunch is that it is related to either InAppPurchases.connectAsync() or InAppPurchases.setPurchaseListener(...)
Exception '-[RCTModuleRegistry getAllExportedModules]: unrecognized selector sent to instance 0x6000006f60a0' was thrown while invoking addProxiedListener on target UMReactNativeEventEmitter with params (
ExpoInAppPurchases,
"Expo.purchasesUpdated"
)
callstack: (
0 CoreFoundation 0x0000000114c14fba __exceptionPreprocess + 242
1 libobjc.A.dylib 0x000000011450cff5 objc_exception_throw + 48
2 CoreFoundation 0x0000000114c23d2f +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x0000000114c194cf ___forwarding___ + 1455
4 CoreFoundation 0x0000000114c1b7a8 _CF_forwarding_prep_0 + 120
5 earnr 0x000000010d9d3d4d __copy_helper_block_e8_32s40s48s56b64b72s + 9734
6 earnr 0x000000010d5a4535 -[RCTEventEmitter addListener:] + 85
7 earnr 0x000000010d9d3f4c __copy_helper_block_e8_32s40s48s56b64b72s + 10245
8 CoreFoundation 0x0000000114c1ba3c __invoking___ + 140
9 CoreFoundation 0x0000000114c18c6f -[NSInvocation invoke] + 305
10 CoreFoundation 0x0000000114c18f02 -[NSInvocation invokeWithTarget:] + 70
11 earnr 0x000000010d5e6094 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2660
12 earnr 0x000000010d5eab37 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 1495
13 earnr 0x000000010d5ea342 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 178
14 earnr 0x000000010d5ea27c ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
15 libdispatch.dylib 0x0000000117b4f70d _dispatch_call_block_and_release + 12
16 libdispatch.dylib 0x0000000117b508df _dispatch_client_callout + 8
17 libdispatch.dylib 0x0000000117b56e15 _dispatch_lane_serial_drain + 715
18 libdispatch.dylib 0x0000000117b5798c _dispatch_lane_invoke + 400
19 libdispatch.dylib 0x0000000117b61f81 _dispatch_workloop_worker_thread + 772
20 libsystem_pthread.dylib 0x00007fff6034045d _pthread_wqthread + 314
21 libsystem_pthread.dylib 0x00007fff6033f42f start_wqthread + 15
)
RCTFatal
facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext)
facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const
invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_lane_serial_drain
_dispatch_lane_invoke
_dispatch_workloop_worker_thread
_pthread_wqthread
start_wqthread
Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!
bare
What platform(s) does this occur on?
iOS
SDK Version (managed workflow only)
No response
Environment
Expo CLI 4.1.4 environment info: System: OS: macOS 11.4 Shell: 5.8 - /bin/zsh Binaries: Node: 16.3.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.15.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 Android SDK: API Levels: 30 Build Tools: 29.0.2, 30.0.3 System Images: android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom IDEs: Android Studio: 4.1 AI-201.8743.12.41.7199119 Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild npmPackages: react: 17.0.2 => 17.0.2 react-native: 0.65.0 => 0.65.0 npmGlobalPackages: expo-cli: 4.1.4 Expo Workflow: bare
Reproducible demo or steps to reproduce from a blank project
Error occurs when user visits screen with following setup
import * as InAppPurchases from 'expo-in-app-purchases';
import React, { useCallback, useEffect, useState } from 'react';
function Products() {
async function purchaseCallback({ responseCode, results, errorCode }: InAppPurchases.IAPQueryResponse) {
// Success purchase
if (responseCode === InAppPurchases.IAPResponseCode.OK && results) {
try {
const [purchase] = results as InAppPurchases.InAppPurchase[];
const { acknowledged, productId, transactionReceipt, purchaseTime } = purchase;
if (!acknowledged && transactionReceipt) {
// Custom logic here
await InAppPurchases.finishTransactionAsync(purchase, false);
}
} catch (err: unknown) {
// Handle error
}
}
// Error purchase
else if (responseCode === InAppPurchases.IAPResponseCode.USER_CANCELED) {
// Handle error
} else if (responseCode === InAppPurchases.IAPResponseCode.DEFERRED) {
// Handle error
} else {
// Handle error
}
}
// Configure and fetch in app purchases
const configureInApp = useCallback(async () => {
try {
await InAppPurchases.connectAsync();
InAppPurchases.setPurchaseListener(purchaseCallback);
} catch (err: unknown) {
// Handle error
}
}, []);
// Disable in app purchases
const disableInApp = useCallback(() => {
InAppPurchases.disconnectAsync();
}, []);
// Configure and listent to in app purchases
useEffect(() => {
configureInApp();
return () => disableInApp();
}, [configureInApp, disableInApp]);
return null
}
export default Products;
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 6
- Comments: 16 (9 by maintainers)
Commits related to this issue
- [modules-core] Fix `-[RCTModuleRegistry getAllExportedModules]: unrecognized selector` (#14130) # Why Fixes https://github.com/expo/expo/issues/14092. # How RN tries to call out method (`set... — committed to expo/expo by lukmccall 3 years ago
- Chore rn-v0.65の対応 https://github.com/expo/expo/issues/14092 — committed to alternacrow/ExistingReactNativeWithExpoNotifications by deleted user 3 years ago
- Chore rn-v0.65の対応 https://github.com/expo/expo/issues/14092 — committed to alternacrow/ExistingReactNativeWithExpoNotifications by deleted user 3 years ago
- Chore rn-v0.65の対応 https://github.com/expo/expo/issues/14092 https://github.com/expo/expo/issues/14186 — committed to alternacrow/ExistingReactNativeWithExpoNotifications by deleted user 3 years ago
- [modules-core] Fix `-[RCTModuleRegistry getAllExportedModules]: unrecognized selector` (#14130) # Why Fixes https://github.com/expo/expo/issues/14092. # How RN tries to call out method (`set... — committed to FelipeACP/expo by lukmccall 3 years ago
oh since expo is using xcframework, you should also append
$ExpoUseSources = ['@unimodules/core', '@unimodules/react-native-adapter']next toplatform :ios, '11.0'in Podfile.I just searched around in my node_modules (keywords:
setModuleRegistry) and applied patches using patch-package with these two:Anyway to implement the merged fix in a bare app before next releases etc…?
@hehex9 <<<---- champion - thats what this guy is - a freaking champion!
Thank you!
Hi, @lukmccall.
Is the fix in #14130 one of many coming fixes or is that meant to solve the issue here? I tried running my app again today and I’m still getting the following issue:
Is there maybe a release on the Expo side needed with your fix? Regardless, thanks for looking into this issue.
The same goes for the
expo-notificationspackage. Once I removed that, I was seeing the same error about InAppPurchases. I have a post on the Expo forum about it and have mentioned this issue there.Update: after removing
expo-notificationsandexpo-in-app-purchases, I no longer see the error/warning. Not ideal, obviously but good to be able to narrow down the issue.