Cocoapods use_frameworks! caused strange compiler errors in the old OC codes - xcode

I added use_frameworks! in my pod file, running pod install again (without any other changes). Then I got the compiler error like 'Masonry.h' file not found with <angled> include; use "quotes" instead.
Although I believed those pod header files should be used with <...> I did change them to "...". But then I got the error like Redefinition of 'FMTokenizerCursor' (from FMDB pod)
I felt like this maybe a cocoapod bug (I am using 1.0.1) so I upgraded it to cocoapods-1.1.0.beta.2, same error. pod deintegrate & pod install made no difference.
I found these is a similar question here. But the answers there did not work for me.
I tried both Xcode 7 & 8, clean ~/Library/Developer/Xcode/DerivedData
same error too.

I met the same problem as you, I try to search for Search Paths in the Build Settings of the project, then add to the User header search paths $ (SRCROOT) and select recursive. But that does not work ... Then I put the "use_frameworks!" was removed from the podfile, recompile the project, problem solved =-=

Here's an example for a Podfile using the new format. (This example project has 2 targets), Try it.
also, make sure you don't edit this file in textEdit. (xCode is preferred)
abstract_target 'YourProject-abstract' do
use_frameworks!
pod 'Alamofire', '3.5.0'
pod 'ObjectMapper'
pod 'FBSDKLoginKit'
pod 'FBSDKCoreKit'
pod 'AlamofireImage'
target 'MyProject' do
end
target 'MyProject-staging' do
end
end

Related

Trying to Rebuild a Legacy IOS App, Getting Error in Facebook-IOS-SDK Cocoapod

I've been asked to rebuild an existing IOS app that uses Facebook-IOS-SDK. The app is at least 5 years old so I expected things to be deprecated. I have some limited experience with XCode and IOS but I'm far from an expert. I've never used cocapods until today. I installed cocoapods and ran pod init. Facebook-IOS-SDK ver 3.24.4 loaded with no errors (other pods too, including Bolt, with no errors).
I've read the migration notes on the FB dev page regarding the versions and it's implied that I should be able to use 3.24. When I do a clean build I get the error:
(FBRequest *)requestForUpdateOpenGraphObject(id<FBOpenGraphObject>)object
{
return [FBRequest requestForUpdateOpenGraphObjectWithId:object[#"id"] graphObject:object];
}
Expected method to read dictionary element not found on object of type 'id<FBOpenGraphObject>'
This error is in FBRequest.m, the cocoapod code, not in my clients code. This code is marked read only. If this is the correct pod version, and I can't change it then is there some other dependency in the (large) project that needs to be updated?
Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, "9.0"
target "tbd" do
pod 'IQKeyboardManager'
pod 'UICKeyChainStore'
pod 'CocoaLumberjack', '~> 2.0.0-beta'
pod 'SDURLCache'
pod 'HockeySDK'
pod 'Facebook-iOS-SDK', '~> 3.23'
pod 'GoogleAnalytics-iOS-SDK'
pod 'UIActionSheet-Blocks', '~> 1.0'
end
target "tbdTests" do
end
The only, nasty, solution I found is to change the code inside FBRequest.m manually.
Change line 370 from:
return [FBRequest requestForUpdateOpenGraphObjectWithId:object[#"id"] graphObject:object];
to
return [FBRequest requestForUpdateOpenGraphObjectWithId:object.objectID graphObject:object];
this should make you project runs again.
Again, this is not a nice solution, but it works :)
Emilio
if you don't have the need to use Facebook-IOS-SDK ver 3.24.4 you can simply use the latest version 4.36.0.
have a look at your Podfile and see if there is any reference to Facebook-IOS-SDK, if there is something like:
pod 'Facebook-IOS-SDK', '~> 3.0'
you can replace it with:
pod 'Facebook-IOS-SDK', '~> 4.0'
otherwise post your Podfile and we can have a look.
Cheers

no such module 'Alamofire' but in Podfile

I have adopted a Swift project from about 6 months ago and am getting the error:
It's probably not an Alamofire issue as changing the order with SwiftlyJSON causes me to get a No such module 'SwiftlyJSON' error.
I have Product -> Clean'd it and rebuilt but nothing seems to work. Here's a copy of the Podfile.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "9.3"
use_frameworks!
target 'TatterTwo' do
# pod 'pop', '~> 1.0'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
pod 'KeychainAccess'
pod 'Alamofire'
pod 'MBProgressHUD'
pod 'SwiftyJSON','3.0.0'
# pod 'Timberjack', '~> 0.0'
end
I am sure I am using the .xcworkspace rather than .xcodeproj
Ok, there might be different reasons behind this error
First, try to stop the build and start again. If this doesn't work then
Open your Podfile, that is supposed to be located inside of the project folder. Podfile configuration. Make sure your target matches the project name. If you did any modification then go to terminal locate the project folder and run sudo pod update, it should give you an output "Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed". After this restart your xcode file. Oh yeah and the last make sure you are opening .xcworkspace instead of xcodeproj
Reinstall Alamofire manually, and restart Xcode.
Make sure you check "No" on the project file for ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES
It took ages for me to get it to work.

Using Cocoapods in a Workspace with two apps

I have two apps (xcode projects) that i want to have in one workspace. Since Cocoapods usually generates the workspace, i looked to see if it was possible to do this and found some answer. The recommended Podfile would look like:
workspace 'TestWorkspace'
target 'TestApp1' do
xcodeproj 'testApp1/testApp1.xcodeproj'
workspace 'TestWorkspace'
pod 'AFNetworking'
end
workspace 'TestWorkspace'
target 'TestApp2' do
xcodeproj 'TestApp2/TestApp2.xcodeproj'
pod 'MBProgressHUD'
end
(sorry wasn't sure how to have SO format the Ruby code)
So my folder structure looks like a TestWorkspace folder, with the two App projects folders, and the Podfile. Running pod install
[!] xcodeproj was renamed to project. Please update your Podfile accordingly.
and..
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target TestApp1 to ../Pods/Target Support Files/Pods-TestApp1/Pods-TestApp1.debug.xcconfig or include the ../Pods/Target Support Files/Pods-TestApp1/Pods-TestApp1.debug.xcconfig in your build configuration (TestApp1/Pods/Target Support Files/Pods-TestApp1/Pods-TestApp1.debug.xcconfig).
So my question is what changes must be made to wind up with my TestWorkspace workspace having three projects: TestApp1, TestApp2, and Pods?
(btw, i changed the true names of my projects/workspaces to pseudo-aliases for the purposes of posting here. Hopefully, I changed everything faithfully.)
EDIT: Ok so i fixed the first warning (just a change in podfile syntax from xcodeproj to project). However, my workspace is definitely not being configured properly. I don't even see a Pod project after pod installing.
EDIT2: OK so i fixed the second warning by setting both project configuration files (debug and release) to "none". So now I have no errors, but the Pod project is still no where to be found. (Sorry if i'm solving parts of the question but I think its better to add edits than to create a new question).
Use the targets as scopes for the xcproject/workspaces. Update the podfile to something like this:
workspace 'TestWorkspace'
target 'TestApp1' do
xcodeproj 'testApp1/testApp1.xcodeproj'
workspace 'TestWorkspace'
pod 'AFNetworking'
end
target 'TestApp2' do
xcodeproj 'TestApp2/TestApp2.xcodeproj'
workspace 'TestWorkspace'
pod 'MBProgressHUD'
end
Now run pod install --verbose

"No such module 'Firebase'" when add Firebase into a library

I just created new Framework and added Firebase via CocoaPods, when combine the library it success.
But when I add that library to other project via CocoaPods as well, then combine that project, and it raise an error: No such module 'Firebase'
Anyone faced a problem like this?
You need to add the follwing to your POD file:
pod 'Firebase'
After that, you need to type in your terminal
pod install (to refresh the pod file)
I solve my problem using just the specific import that I'm using, for example.
In my SDK I'm using FirebaseCore and FirebaseAnalytics.
Into my class I just import:
import FirebaseCore
import FirebaseAnalytics
And in my .podspec I needed to set static_framework property to true, so my .podspec it's seems like code below:
s.static_framework = true
s.dependency 'Firebase'
s.dependency 'Firebase/Core'
It works for me!
Do you open the workspace file after installed with cocoa pods ?
Check if the library is added in "Linked Frameworks" or "Embedded Binaries"
If it didn't work, add this pod file
platform :ios, '8.0' use_frameworks! target ‘Your Project’ do
pod 'Firebase', '>= 2.5.1'
pod ‘Firebase/Auth’
pod ‘Google/SignIn’
pod ‘Firebase/Database’
pod 'Firebase/Storage' end
and then type pod deintegrate and after that run pod install.
tried all these..
I was stuck in this situation for more than 2weeks.
finally resolved by adding "excluded architectures = arm64"
this is the easiest solution nowadays
Everything was setup fine and was working before but..
My Problem:
What's was wrong with me?
I was using older name of pod, eg. - pod 'Firebase/Analytics', pod 'Firebase/Crashlytics'
New pod names are pod 'FirebaseAnalytics', pod 'FirebaseCrashlytics' (Problem with / )
Solution:
Use new pod name to integrate pod 'FirebaseAnalytics', pod 'FirebaseCrashlytics' (Install pod with new pod name)
Import import FirebaseCore, import FirebaseAnalytics instead just import Firebase
import FirebaseAnalytics - I'm using for log events
Hi today i fix same problem
1 : open podfile from xcode than add " pod 'Firebase' "
save and close it
2 : open vscode or any editor using, open new terminal than write " cd ios " to open ios file than " pod install " when you install it showing problem need to add search path
so now open ios file from xcode and go to : runner > target runner > build settings > all > search paths
and add this " $(inherited) " into framework search path and header search path
that's all
For me I had to change the version specified in the Podfile as it was above what my app supported. Specifically in the Podfile I changed: 'platform :ios, '11.0' to platform :ios, '10.0' which corresponds with Deployment Info in the General Tab for my app I'm working on.
For Flutter folks adding Firebase to their apps, make sure you follow the steps in Add Firebase to your iOS Project as well as those in the SDK setup steps in the Firebase Console:
In summary:
Run pod init if you don't have a pod file
Add the necessary pods to the bottom of the podfile. All possible Firebase pods can be found here.
pod 'Firebase/Analytics'
pod 'Firebase/Firestore'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
Run pod install
This issue can be caused by incorrectly set-up schemes:
If you have multiple schemes (e.g. 'Dev', 'QA', 'Production' etc.) in your project, check you have the build configurations set correctly.
Further guidance in this answer here:
https://stackoverflow.com/a/65453578/12322900
Then run pod deintegrate and pod install and make sure you're using the .xcworkspace file.
My failure was that I downloaded modules to
target 'YourProjectUITests' do
# Pods for testing
pod 'FirebaseCore'
And the right one is
# Pods for YourProject
pod 'FirebaseCore'
(Without UITests)
It is because you don't have added pod dependency in Podfile.
you will find below line in Podfile
Uncomment this line to define a global platform for your project
#platform :ios, '9.0'
follow the below steps.
1)just remove the # .so it will be like.
platform :ios, '9.0'
2)add the below dependencies.(Do not add all ,you just need to add whatever used in you app ,if you have used Firebase/Core only then add that line only)
#Pods for app name
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
3)clean the build
flutter clean
4)run Command :
flutter run (It will automatically adds a required pods).
that's it.
The same thing happened to me last week. I solved it by:
1. pod deintegrate
2. Open Xcode and delete any instance of pod.
3. pod install

Cocoapods frameworks.sh error: no such file

So I'm fairly new at both Swift and working with cocoapods, and after spending several days of researching I cannot figure out why my project isn't building. I get the following error:
(My project)/Pods/Target Support Files/Pods-(My project)/Pods-(My project)-frameworks.sh: No such file or directory
I am using Xcode 7.2.1 and Cocoapods 0.39.0 and I seem to have tried all the troubleshooting tips from Cocoapods' website. Can anyone tell me what I need to do to make it work?
My podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
use_frameworks!
pod 'GoogleMaps'
pod 'FontAwesome.swift'
pod 'Lock', '~> 1.21'
pod 'JWTDecode', '~> 1.0'
pod 'Lock-Facebook', '~> 2.1'
pod 'SimpleKeychain', '~> 0.7'
pod 'Bolts', '~> 1.6'
pod 'FBSDKCoreKit', '~> 4.1'
pod 'FBSDKLoginKit', '~> 4.1'
pod 'MBProgressHUD', '~> 0.9.2'
pod 'Alamofire', '~> 2.0'
pod 'CocoaLumberjack/Swift'
pod 'AFNetworking', '~> 2.5'
pod 'Auth0', '~> 0.2'
You're probably missing the target block for your target, in the Podfile.
I added a target to my project, and forgot to add a target block to the Podfile for that target, and I had the same error.
(My project)/Pods/Target Support Files/Pods-(My project)/Pods-(My project)-frameworks.sh: No such file or directory
The path components are actually named after the target:
(My project)/Pods/Target Support Files/Pods-[target]/Pods-[target]-frameworks.sh
Cocoapods builds configuration files for each target that you specify. Try adding a target entry to your Podfile, like so:
target "SOME TARGET" do
specify pods here
end
If you end up adding a lot of targets, it might be a good idea to define pod groups that you can easily use inside your target entries. So, you would define your groups above your target entries, like so:
def commonPods
specify pods here
end
Then you can use the group name in your pod entry, instead of copying all the pod entries for every target:
target "SOME TARGET" do
commonPods
end
Adding the target entry in your Podfile will cause CocoaPods to generate a new set of files the next time you run pod install. However, before you run that command, you will probably need to set your configurations to None, so that Cocoapods can assign its own configuration. Here's how to do that:
Go to your project-level target
For each configuration listed under Configurations, select None for your target, in the drop-down menu under Based on Configuration File.
These steps will eliminate the Cocoapods warning that reads:
CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all...
Once you've edited your Podfile and you nullified your configurations, you're ready to run pod install on the command line. After the process is completed, check back with your base configuration settings, and note that they have been set to the configuration file that was generated by CocoaPods!
I hope that helps!
This is kind of dumb, but it happened to me:
You might be in the wrong directory.
I was running pod install from directory Desktop/Project/Project Files, and I kept getting an error like this.
Then I realized I was in one step too far, so I went up to directory Desktop/Project, and it worked.
As to why pod install even ran considering the Podfile was in Desktop/Project and not Desktop/Project/Project Files... ¯\_(ツ)_/¯
My problem is that " blablabla Pods-XXXX-frameworks.sh: No such file or directory"
Firstly, I fix it by using command line "pod install" , it has nothing effection.
The finally solution :
Touch "Build Phases" -> "Embed Pods Frameworks" ,you can see the path :XXXXX.sh"
Be sure that the XXX.sh is the same as your project's. if not, change the path.
Then clean and build.
It's done.
Make sure that you are running pod install in the same directory where you have your xcode project.

Resources