mixpanel / mixpanel-swift

Official iOS (Swift) Tracking Library for Mixpanel Analytics
https://mixpanel.com
Apache License 2.0
435 stars 234 forks source link

pod install build failure: Use of unresolved identifier 'ExceptionWrapper' #229

Closed piemonte closed 6 years ago

piemonte commented 6 years ago

hey mixpanel,

with the latest update, i believe the ExceptionWrapper isn't being picked up in scope. this is causing the build to be fail when installed via cocoapods for iOS.

it looks like it may be the project's "Bridging Header" configuration, as it's defined as Mixpanel-Swift.h but the bridge header with the include is called Mixpanel.h.

/Pods/Mixpanel-swift/Mixpanel/Persistence.swift:230:9: Use of unresolved identifier 'ExceptionWrapper'
bohachevskyy commented 6 years ago

Same issue. @piemonte did you find the solution?

zihejia commented 6 years ago

hi @bohachevskyy and @piemonte , what's your Podfile look like? It should work if looks like below for example:

target
 'testProject' do
  use_frameworks!
  pod 'Mixpanel-swift'
end

Also bridging headers aren't allowed in frameworks, only in applications. So it should have no bridging header defined for Mixpanel.

Mixpanel.h, the umbrella header is the 'master' header file for Mixpanel framework, not a bridging header.

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/IncludingFrameworks.html

piemonte commented 6 years ago

hey @zihejia thanks for the fast reply.

so my Podfile matches your description. the prior version 2.4.4 builds correctly but when updating to 2.4.5, the new ExtensionWrapper objc file is not found.

the project does reference a 'Mixpanel-Swift.h' which does not exist, thus why I thought it could be updated to 'Mixpanel.h'. can look into it when i have a free moment.

piemonte commented 6 years ago

@bohachevskyy i'm just sticking the previous version for now 👍

piemonte commented 6 years ago

@zihejia i've had to embed objc in a swift framework once in the past, following this pattern:

📎 https://github.com/danieleggert/mixed-swift-objc-framework

Not sure if that's how mixpanel is setup but wanted to share. thanks again for the help.

zihejia commented 6 years ago

hi @piemonte thanks for sharing the sample. In Mixpanel framework, swift only needs to access public objc class, so it's supported out of box, much easier than the sample. Could you share with me which XCode version you are using? Your main project is also swift, right?

bohachevskyy commented 6 years ago

thank you for reply @piemonte I did exactly the same :)

bohachevskyy commented 6 years ago

@zihejia My podfile also match your description. Now I'm using older sdk:

pod 'Mixpanel-swift', '2.4.3'

zihejia commented 6 years ago

hi @bohachevskyy , which Xcode version are you using? Do you mind to create a sample project to demonstrate the error?

bohachevskyy commented 6 years ago

@zakj Xcode version: 9.4.1. I'll provide test project when get chance :)

zihejia commented 6 years ago

Since you were upgrading from the old version, If you do a clean build(Command-Option-Shift-K to clean out the build folder, quit Xcode and clean out ~/Library/Developer/Xcode/DerivedData manually. , reset simulator, restart Xcode), the problem should go away. Closing this one out, please re-open if you're still experiencing the problem and the solutions suggested don't resolve it.