Can't install a pod (Mixpanel) via CocoaPods - Fails to compile (file not found) - Bridging header issue?

岁酱吖の 提交于 2019-12-23 22:06:13

问题


I'm trying to update my project's version of Mixpanel to use Cocoapods, as it was previously installed manually. I already was using Cocoapods, so I assumed it would have been an easy update to just add pod 'Mixpanel', '~> 2.9' to the Podfile and run pod install. After doing this, I am getting the following errors:

At the import statement #import "Mixpanel.h"

/Users/timc/ios/app/MyApp/Classes/AnalyticsUtil.h:10:9: 'Mixpanel.h' file not found

And also this one

Failed to import bridging header '/Users/timc/ios/app/MyApp/Classes/MyApp-Free-Bridging-Header.h'

I'm trying to import Mixpanel into an Objective-C file. My Podfile looks like this...

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Alamofire', '~> 3.1'
pod 'AlamofireObjectMapper', '~> 2.1'

target 'MyApp' do
    pod 'Mixpanel', '~> 2.9'
end

target 'MyApp Tests' do

end

target 'WatchKit Extension' do
    pod "Mixpanel/AppExtension"
end

target 'WatchKit App' do
    pod "Mixpanel/AppExtension"
end

target 'MyAppSharedFramework' do
    pod 'Alamofire', '~> 3.1'
    pod 'AlamofireObjectMapper', '~> 2.1'
end

So what do I need so my project can find the Mixpanel source files? I've tried using #import and while that allows me to option-click to navigate to the right file, the project still fails to build.

I'm running Xcode 7.2, and project is a mix of Objective-C and a bit of Swift.

Happy to provide any further information to help diagnose this issue!


回答1:


I was able fix this issue by removing the workspace and regenerating it.

rm -rf MyProject.xcworkspace
pod install

So clearly something with my workspace was corrupted... this resolved it.



来源:https://stackoverflow.com/questions/34341655/cant-install-a-pod-mixpanel-via-cocoapods-fails-to-compile-file-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!