Closed jonathandion closed 7 years ago
Once you install with cocoapod you should open your xcode project with the newly created workspace inside your ios folder. Once opened try building it.
Hi Jonathan,
The bridge imports "Buy.h". What version of the Pod are you using and did you run react-native link?
Could you give us the exact file and line where this error is raised?
@donedgardo Hi, exactly what I did but failed.
@sirhotsauce cocoapod version 1.2.0
and shopify sdk 2.2.0
. Yes, I ran the link command. No issue there.
I built the project using xCode and react-native run-ios
both failed.
React native version react-native-cli: 2.0.1
react-native: 0.41.2
@jonathandion
Use Mobile Buy SDK 2.2.0 pod instead of 1.2.0.
@sirhotsauce Sorry about that I'm using Mobile-Buy-SDK (2.2.0)
my Cocoapod installation is 1.2.0
@jonathandion
It can't find the protocol in the PassKit framework that the Shopify iOS SDK is linking to. It has something to do with your XCode, iOS or CocoaPods version. What version of XCode is this? I use 8.2.1 and CocoaPods 1.1.1. Try changing these parameters.
Btw, did you open .xcodeproj or workspace? You need to open the workspace file after installing the pod.
@sirhotsauce I updated my Xcode now it's working. I still have an error argument 0 (NSUInteger) of RNShopify. must not be null
Your help is appreciate. thanks.
@jonathandion Is that when your calling Shopify.getProducts()
? In that case, just replace it by Shopify.getProducts(1)
.
@jgrancher it's working thanks. How come I need to add 1?
@jonathandion For some reason, the simplest way to get your products from the Shopify SDK is via their mehod getProductsPage:completion
that requires a page number, starting from page 1. You can also get your products by Tags or Ids, if you need to.
From this bridge though, you shouldn't need to specify 1
as it's the default argument since this PR #8.
@jgrancher thank you for the details! We need to update the Readme it's confusing.
Hi, I installed Mobile Buy SDK for IOS according to Dynamic framework installation instructions( Dragged Mobile Buy SDK.xcodeproj to the Libraries folder; added Buy as a Target Dependency; Add Buy.Framework as Embedded Binaries in General tab) and after that ran react-native link react-native-shopify. When building the project, the following error occurs: "Buy.h file not found" in RNShopify.h file. Can you advise what else should I do to correctly import Buy.h? Thanks!
Hi @webmaster100 ,
Any reason you're not using CocoaPods? We can debug this, but if you have an option to use Pods, it would work out of the box.
Hi @Air-Miha, I used it earlier, but there was an error "Shopify.initialize is not defined" and I could not resolve it with packager restart. I tried it again and this time the error gone . With CocoaPods it is working. Now when calling getProducts Shopify.getProducts(1).then(products => { console.log( 'products', products); }).catch(error => { console.log( 'error', error); }); the app crashes and the console in Xcode shows the following error: How can I resolve it? Thank you!
@webmaster100, what version of the SDK are you using? And, do you have any products in your shop? It seems that parsing the products from JSON fails in the SDK. Put some logs there in XCode and see what object becomes nil and crashes everything.
@Air-Miha, I am using 2.2.0. I see that products are returned The error occurs after this line and debugger do not go further Also the same error occurs for Shopify.getCollections(1)
When running the following code: var cart = [{ variant: 29192253131, quantity: 1, }]; Shopify.checkout(cart).then(products => { I get an error -[__NSCFNumber count]: unrecognized selector sent to instance 0xb000006cbfe6ecb3' was thrown while invoking checkout on target RNShopify with params ( ( { quantity = 1; variant = 29192253131; } ) I have not found documentation for different methods, so I am not sure is it a proper format for cart parameter. I am not IOS developer and finding the correct method usages in Mobile Buy SDK Sample App is not the easiest option. What can be the cause of this error? Thanks!
@webmaster100,
Can you log (using NS Log) all the products returned? It will tell us why the SDK breaks on this method. We're using 2.2.0 as well.
As for the cart, check out this thread:
@Air-Miha, I could not use NSLog or printf, it seems there is some bug with printing logs in Xcode 8 and simulator. I copied one of the product from debug window: <__NSArrayI 0x6000003a4600>( { available = 1; "body_html" = "
Condition: Barely Used
\nPersonal Note:
\n<p style=\"padding-left: 30px;\">\"not specified\"\n@webmaster100, this looks like a similar issue to this one:
https://github.com/Shopify/mobile-buy-sdk-ios/issues/405
Could you tell me the steps you did to include the Mobile Buy SDK? Perhaps the issue is something trivial.
Here's what we did:
Did you do anything else in between? Also, could you try with a different XCode version? In the worst case, you can do what the guys in the above thread did: copying the managed object model file directly into your project. But, perhaps uninstalling and then reinstalling everything will help.
Keep us posted!
@Air-Miha I just run pod install with the file like this:
frameworks use_frameworks! pod "Mobile-Buy-SDK" end There were a warning about overwriting Framework Search Paths and I added $(inherited) to the list of paths as described in this message. But this didn't fix the error. After I copied by reference the datamodel file to Compile Sources it started to work. Thank you!
Closing since it's resolved.
Hi,
When I run the command
react-native run-ios
to build the project I got 2 errors from the Shopify ios SDK:error: cannot find protocol declaration for 'PKPaymentAuthorizationControllerDelegate'; did you mean 'PKPaymentAuthorizationViewControllerDelegate'?
I installed the SDK with cocoapod but never called #import "Buy.h" inside my Xcode project. Should I?
Thanks.