Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to run the example #8

Open
jcohenho opened this issue Oct 11, 2024 · 4 comments
Open

Error when trying to run the example #8

jcohenho opened this issue Oct 11, 2024 · 4 comments
Labels
📱 iOS Related to iOS 🕵️‍♂️ need more investigation Need investigation on current issue

Comments

@jcohenho
Copy link

Description

When trying to create a local build with the included example, I get the following error related to these lines in the code:

  Function("initConnection") {
      |                                    ^ cannot infer return type for closure with multiple statements; add explicit type to disambiguate
  116 |             self.productStore = ProductStore()
  117 |             return AppStore.canMakePayments
  118 |         }

To Reproduce

Steps to reproduce the behavior:

  1. Clone the repo and navigate to the example folder
  2. Run yarn
  3. Run npx expo run:ios
  4. See the error above is thrown
@hyochan hyochan added 📱 iOS Related to iOS 🕵️‍♂️ need more investigation Need investigation on current issue labels Oct 24, 2024
@SolankiYogesh
Copy link

facing same in bare react native project

@SolankiYogesh
Copy link

@hyochan here
Function("initConnection") { self.productStore = ProductStore() return AppStore.canMakePayments }

@SolankiYogesh
Copy link

SolankiYogesh commented Nov 25, 2024

Fixed @hyochan @jcohenho

      Function("initConnection") { () -> Bool in
            self.productStore = ProductStore()
            return AppStore.canMakePayments
        }

   Function("disable") {() -> Bool in
            self.removeTransactionObserver()
            return true
        }

@SolankiYogesh
Copy link

diff --git a/node_modules/expo-iap/ios/ExpoIapModule.swift b/node_modules/expo-iap/ios/ExpoIapModule.swift
index d429b5d..ef8689d 100644
--- a/node_modules/expo-iap/ios/ExpoIapModule.swift
+++ b/node_modules/expo-iap/ios/ExpoIapModule.swift
@@ -111,8 +111,7 @@ public class ExpoIapModule: Module {
             hasListeners = false
             self.removeTransactionObserver()
         }
-
-        Function("initConnection") {
+        Function("initConnection") { () -> Bool in
             self.productStore = ProductStore()
             return AppStore.canMakePayments
         }
@@ -433,7 +432,7 @@ public class ExpoIapModule: Module {
             #endif
         }
 
-        Function("disable") {
+        Function("disable") {() -> Bool in
             self.removeTransactionObserver()
             return true
         }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📱 iOS Related to iOS 🕵️‍♂️ need more investigation Need investigation on current issue
Projects
None yet
Development

No branches or pull requests

3 participants