I'm trying to install the MapboxGeocoding framework with Cocoapods and Xcode9. Unfortunately Xcode can't find the module. It shows me the following error: Cannot load underlying module for 'MapboxGeocoder'
The pod file looks as the following:
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
target 'FrameworkTest' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'MapboxGeocoder.swift', '~> 0.7'
# Pods for FrameworkTest
end
I checked also the build settings of the Xcode Project. It looks like the following:
Framework Search Path
Finally nothing worked for me. Any suggestions to solve this problem?
PS: The normal MapBox Framework works well with cocoapods
I guess your framework header search path is missing this path. Try adding $(inherited) $(PROJECT_DIR) $(PROJECT_DIR)/YourProjectFramework folder in Framework search path
Hope this helps you!
Related
I've installed FBSDK with Cocoapods but can't import it in my AppDelegate.swift file for some reason. The FBSDK kit appears in my Xcode project so I feel like it should be working.
I'm not an iOS developer by any means, I'm just trying to write a simple native plugin for Flutter SDK. Anyone an idea?
--Here is what the pod file looks like--
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
if ENV['FLUTTER_FRAMEWORK_DIR'] == nil
abort('Please set FLUTTER_FRAMEWORK_DIR to the directory containing Flutter.framework')
end
target 'Runner' do
use_frameworks!
# Pods for Runner
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
# Flutter Pods
pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR']
if File.exists? '../.flutter-plugins'
flutter_root = File.expand_path('..')
File.foreach('../.flutter-plugins') { |line|
plugin = line.split(pattern='=')
if plugin.length == 2
name = plugin[0].strip()
path = plugin[1].strip()
resolved_path = File.expand_path("#{path}/ios", flutter_root)
pod name, :path => resolved_path
else
puts "Invalid plugin specification: #{line}"
end
}
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
---EDIT---
I''m getting the following error atm: FBSDKCoreKit.framework: No such file or directory.When I open the Frameworks folder in xCode, all file names are in red:
But that exact folder in Finder is empty. So I guess that's why the error is showing. The question is how to fix this...
This is what my embedded binaries and linked frameworks and libraries look like in the project:
Select your Project Target
Go to Build Settings.
Search for Header Search Paths.
Add this value $(SRCROOT)/Pods with recursive, then Xcode will resolve the path for you.
Are you opening the .xcodeproj or the .xcworkspace? Make sure it is the workspace whenever you install a cocoapod
I'll naively suppose you don't have use_frameworks! in you Podfile. If that's true, than you have two ways to go from here:
In your Runner-Bridging-Header.h add #import <FBSDKCoreKit/FBSDKCoreKit.h>, remove import FBSDKCoreKit from AppDelegate.swift and just continue writing the code.
Add use_frameworks! to your Podfile and run pod install again. That might bring some other issues, but if that works, than I'd suggest it.
If you use cocoapods, it should have generated a *.xcworkspace file for you. Open this file instead so your project can see the FBSDK installed and has reference to it.
When you install your pods, you must build your application first. Then your imports stop showing errors.
Why not simply use the Swift pods?-
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
and then import as normal, like-
import FBSDKLoginKit
import FacebookLogin
Once done, do a clean and build (command/⌘ + Shift + K) and Build (command/⌘ + B). Make sure you are using the .xcworkspace file to open the project.
More info on Swift FBSDK here.
Once you use the Swift pods, you should see these Frameworks in your project.
If you still continue to see the error then "Clean the build folder" using command + shift + alt + K.
Start by cleaning your project using Command + Shift + K then close the project and delete the pods folder and the pod.lock file and your .xcworkspace file. Then run pod install and see if that fixes the issue.
First Clean your project directory. And add $(inherited) in framework search path in Build settings.
As importing the FBSDKCoreKit.framework etc. will be performed in the [CP] Embed Pods Frameworks build phase when using CocoaPods, you should remove the references to these frameworks in the Embed Frameworks build phase.
CocoaPods will not create those references, I assume you have tried other ways of importing the Facebooks frameworks, and these link have been created in the process. You can also delete the references to the Facebook frameworks in the Frameworks Folder of you App-Project (the ones in your screenshot written in red, not the ones in the Pods-Project!), but keep the Pods_Runner.framework there.
From what I can tell, your Linked Frameworks and Libraries section looks valid.
If it still doesn't work, I'd advise you to create a new Xcode Project with an empty Podfile, and only include the Facebook frameworks via CocoaPods. Importing the Facebook-SDK in the AppDelegate should work then, otherwise I can share a sample project with you. Then you should check your build setting and build phases, maybe something is wrong there. If you still can't figure out the problem, you will probably need to re-create you xcode-project and import all your files again.
Without a sample Project that reproduces the error, that's the best advise I can give.
Good Luck! :)
The above solutions for Header Search Path should work.
If you are too lazy to go there.
Copy podfile content, remove all pods, pod install, then revert your podfile, pod install again.... Should work ;-)
In my case, it was correctly installed but I realized the pod is Objective-C and couldn't import it on a Swift file. I had to create a bridging header to make it work.
Refer to this stackoverflow thread
How to import existing Objective C classes in Swift
Perhaps this is a n00b question but I'm going to ask it anyways. I followed the instructions for adding Firebase to a Swift app via CocoaPods. Everything seems to have worked fine. Here is my Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'FirebaseDemo2' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for FirebaseDemo2
pod 'Firebase'
end
When trying to import the Firebase module into the AppDelegate, at first Xcode complains it cannot find it but the project builds just fine. However, when trying to add the FIRApp it then fails to build because it cannot find the class.
The Podfile is in the same directory as the .xcodeproj and I am opening the .xcworkspace file in Xcode. This is really confusing me. Can someone see what I am doing wrong? Is CocoaPods misconfigured?
I had the same problem, it installed 2.5.1 but you need 3.2.0
Try running
pod update Firebase
You should now have Firebase 3.2.0
I think your Podfile should look like this:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!
target 'FirebaseDemo2' do
pod 'Firebase'
end
Make sure to open the Xcodeworkspace and not the Project
In Podfile I
pod 'AFNetworking', '~> 2.6.0'
pod update and I open project using xcworkspace.
And everything gone my way,but:
when i import AFNetworking ,Xcode prompt 'No such module AFNetworking'
I searched the solution for this question, and did like this: in 'Built setting ->User Header Search Paths ' add ${SRCROOT} and choose recursive.
But it didn't work . Xcode throw the same mesage :'No such module AFNetworking'
Okay,I just did a mistake operation .
platform :ios, '8.0'
use_frameworks!
Two line above is necessary ! After I added them and run pod update, my project's Link Binary With Libraries add a row contain Pods_.framework .Then I import AFNetworking is OK.
check out there :No such module 'RestKit' with cocoapods and swift
Go to
Project > General > Linked Frameworks and Libraries
When press "Plus" and add your framework from list.
I am getting an error when building my app after i removed reference to a framework i added incorrectly. i am new to ios and cocoapods
/Users/MyMac/Library/Developer/Xcode/DerivedData/MyApp-ewxrexwuczochyctnqvlyusrtvvy/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-5874133373474758EEC76CFD.sh: line 2: /Users/MyMac/Documents/MyApp/Pods/Target Support Files/Pods-MyApp/Pods-MyApp-frameworks.sh: No such file or directory
I am aware that the file and directory don't exist and that is the way it should be but where is it finding the reference to this file so i can remove it and be rid of the error.
I have checked the following:
Linked Frameworks andLibraries under the general tab of my project
The frameworks group in the project
framework search paths under build settings tab
i have also run pod update after removing it from the pod file
How can i fix this?
Edit
back story
I was trying to add the framework https://github.com/Alliants/ALAccordion . in the instruction it said to use
# Podfile
target 'My Target' do
use_frameworks!
pod "ALAccordion"
end
so i added MyApp where my Target is and it created a framework named Pods-MyApp which i cant remove completely.
hope this helps
Cocoapods wrote a tool to completely deintegrate all of this stuff from your project so it goes back to running standalone. It sounds like you had an issue adding the correct target, so use this:
https://github.com/CocoaPods/cocoapods-deintegrate
Then try again so you can at least start from good ground. Hope this helps!
It happened with a prerelease version of Cocoapods 1.2.0.beta.1, by reverting to stable version and running pod install, then clean build, it worked.
why
use_frameworks!
after
target ... do
here is example
platform :ios, '8.0'
use_frameworks!
inhibit_all_warnings!
target 'XXX' do
pod 'RealmSwift'
end
target 'XXXTests' do
pod 'RealmSwift'
end
I have been trying to import the Dropbox-iOS-SDK into my project through CocoaPods, but the framework file doesn't seem to be imported properly. My Podfile looks like this:
platform :ios, '7.0'
pod "AFNetworking", "~> 2.0"
pod 'Reachability'
pod 'Facebook-iOS-SDK', '~> 3.9'
pod "Dropbox-iOS-SDK"
I am new to CocoaPods and I'm not sure where I am going wrong. I tried cleaning the project and restarting Xcode. But the Pods Frameworks file still looks like this:
As a result of this I am getting the following errors during build:
Any idea how I can fix this?
I was adding cocoa pods to an existing project and so I had to remove references to all paths to previously imported frameworks and headers. Once I removed these, everything worked fine.
This is in case someone runs into the same problem.
Same response as Rameez with more precision :
As I had previously added libraries without Cocoapod, my project settings were not clean. When running pod install, the "Framework search path" and "header search path" were not set correctly.
To get the correct value for those two search path :
create an empty project
add the previous podfile in the new project (just change the target name)
run pod install
Look at the Framework and header search path values in the new project
Copy-paste those values into your previous project settings
For me, the problem was with Other Linker Flags and Runpath Search Paths, which weren't inheriting the settings defined on xcconfig. The following adjustments solved my problem:
Other Linker Flags:
$(inherited)
Runpath Search Paths:
$(inherited)
#executable_path/Frameworks
After pod setup successfully-
Take This steps-
1] touch podfile
2] open -e podfile
You will then get a text editor file. Now add your files properly.
Now Save that and close that window and your Project window also.
Go to Finder and you will get an proj.workspace file.
Open That one.
Now..........
now under xcode.proj you will find an proj.test. Go there and change deployment Target with your project name.