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

'Paystack/Paystack-Swift.h' file not found #45

Open
BadMask121 opened this issue Apr 11, 2021 · 5 comments
Open

'Paystack/Paystack-Swift.h' file not found #45

BadMask121 opened this issue Apr 11, 2021 · 5 comments

Comments

@BadMask121
Copy link

BadMask121 commented Apr 11, 2021

Problem/Motivation

Currently getting this error on build 'Paystack/Paystack-Swift.h' file not found
Working with react native and paystack

Screenshot 2021-04-11 at 12 40 21 PM

Screenshot 2021-04-11 at 12 41 23 PM

@IyiolaOwabumowa
Copy link

Is there a solution ?

@ravi-paystack
Copy link
Contributor

@IyiolaOwabumowa @BadMask121 thank you for reporting this. Can you provide more details regarding this issue like cocoapods version, Paystack SDK version, etc.

@IyiolaOwabumowa
Copy link

Hi @ravi-paystack,

react-native: 0.63.4
react-native-paystack: ^3.4.0
CocoaPods: 1.10.1

I can send you my pod file as well if you need. I've been on this issue for over a week now.

Thank you 🙏

@ThadeusAjayi
Copy link

@IyiolaOwabumowa What worked for me was more of a downgrade of paystack version running in react-native-paystack;

rm -rf node_modules
Delete Pods folder under the ios folder
Change paystack version in Podfile.lock file
from: - Paystack (3.0.17):
- Paystack/Core (= 3.0.17)

  • Paystack/Core (3.0.17)

to: - Paystack (3.0.13):
- Paystack/Core (= 3.0.13)

  • Paystack/Core (3.0.13)

run npx pod-install

In case any other packages throw error in the iOS project, remove the package and re-add it.

I hope it works for you.

@jeshurun-io
Copy link

Add this to the pod file to fix the issue:

  post_install do |installer|
    # Run the fixit script for Paystack before building it
    installer.pods_project.targets.each do |target|
      if target.name == 'Paystack'
        puts "Found Paystack! installing fixit script"
        script = target.new_shell_script_build_phase('Fix Paystack')
#        script.shell_script = '${PODS_ROOT}/../scripts/fix_paystack.sh'
        script.shell_script = <<-DESC
REAL_SWIFT_HEADER="${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h"
NEW_SWIFT_HEADER="$TARGET_BUILD_DIR/Paystack.framework/Headers/Paystack-Swift.h"
if [[ ! -e "$NEW_SWIFT_HEADER" ]]; then
  mkdir -p "$(dirname "$NEW_SWIFT_HEADER")" && ln -s "$REAL_SWIFT_HEADER" "$NEW_SWIFT_HEADER"
fi
DESC

        target.build_phases.unshift(target.build_phases.pop)
      end
    end
  end

The problem is that the Paystack target is unable to find the swift header when compiling from cocoapods because it is imported as a global header #import <Paystack/Paystack-Swift.h>. It should have been imported as #import "Paystack-Swift.h" to work in cocoapods. This fix sets up a fake framework in the framework search path and sets up the swift header using a symlink to the real swift header before compiling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants