简体   繁体   中英

Expected Type error in Stripe objective-c

I am integrating Stripe Payment gateway in my app. But there is "Expected a type" error. I exactly don't know what is the issue. The issue comes in this line,

- (void)paymentViewController:(PaymentViewController *)controller didFinishWithToken:(STPToken *)token email:(NSString *)email error:(NSError *)error;    

This method is inside PaymentViewController.h file.
I simply drag and drop the "stripe.framework" with "PaymentViewController.h" and "PaymentViewController.m" file.

Can anyone help me? Thanks in advance.

It sounds like something isn't quite right about how you have added the Stripe SDK to the your project.

If you are using the Stripe SDK as a dynamic framework, then you should ensure that you did the following:

  1. Head to https://github.com/stripe/stripe-ios/releases/latest and download and unzip Stripe.framework.zip .
  2. Drag Stripe.framework to the "Embedded Binaries" section of your Xcode project's "General" settings. Make sure to select "Copy items if needed".
  3. Head to the "Build Phases" section of your Xcode project settings, and create a new "Run Script Build Phase". Paste the following snippet into the text field:

bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Stripe.framework/integrate-dynamic-framework.sh"

If you are using Stripe as a static framework (which is only suggested if you must support iOS 7, then make sure that you have done the following instead:

  1. Head to https://github.com/stripe/stripe-ios/releases/latest and download and unzip StripeiOS-Static.zip .
  2. In Xcode, with your project open, click on "File" then "Add files to Project...".
  3. Select Stripe.framework in the directory you just unzipped.
  4. Make sure "Copy items if needed" is checked.
  5. Click "Add".
  6. In Xcode, click on "File", then "Add files to Project...".
  7. Select Stripe.bundle, located within Stripe.framework.
  8. Make sure "Copy items if needed" is checked.
  9. Click "Add".

Once you've done either of these sets of steps, you should save your project, and then clean your project via the "Product" > "Clean" menubar option. Then try rebuilding your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM