Does 'pod setup' need to be run every time a CocoaPod is added to a project? - ios

Original issue: xcodeproj components didn't display in workspace
I've installed Cocoapods on my machine. When I install a pod in a project, a workspace is created, but when I open the workspace the files associated with the original project don't display. I had Xcode closed when I created the pod. I've attached a screen cap of my project after installing the Pods.
I think I've got an installation problem, but I don't know where I need to look to fix it. What/where should I be checking?!
Update: Compiler error
The following compiler error comes up when I open the workspace file:
podsexample.xcodeproj Couldn't load podsexample.xcodeproj because it is already opened from another project or workspace
I closed Xcode when I created the pod, so I'm stumped on this one.
Update 2: It works, but is this the way it's supposed to work? I got partway to the answer to my problem by following the steps outlined in this helpful post:
Can't get to work CocoaPods and Yosemite
In order to open the workspace file correctly, I have to run 'pod setup' each time. Are CocoaPods supposed to work like this, or is setup supposed to be a one time thing? If I've got an installation/configuration problem, where/what should I be looking at to fix?
Screen Cap of Original Issue

podsexample.xcodeproj Couldn't load podsexample.xcodeproj because it is already opened from another project or workspace
Looks like you had two copies of Xcode open with the same project. One was inside the Xcodeworkspace that CocoaPods created, and the other was the original Xcodeproject itself. Xcode doesn't allow this, so it won't compile as long as both are open. You only need to open the XCWorkspace.

Related

Xcode Cloud No such Module Cocoapods library

I have a project using a Cocoapods as dependency manager and I am trying to create an Xcode Cloud workflow for it, everything look simple to configure and I added the ci_post_clone.sh to run the pod install command before start building.
Based on the logs all the dependencies are downloaded but whenever it starts building I have the No such Module X error, I am not sure what i did wrong but it looks like xcode Cloud misses the step of Building targets in dependency order and it starts building the main project before building the dependencies
Did anyone face this problem and how did you fix it
Thank you for your help
I found a temporary solution by adding the pod folder to my repository, this is not what most people are willing to do but for now it is working
do you have a screenshot for how you set this up? Because the script file ci_post_clone.sh needs to exist in a repository named ci_scripts that is at the same level as your workspace / xcode project. You also need to be sure to mark that file as executable
then you can brew install cocoapods and run pod install on that script. cheers! just got this working this morning by following notes found here: https://developer.apple.com/documentation/xcode/making-dependencies-available-to-xcode-cloud

'FBSDKShareKit/FBSDKShareKit.h' file not found

I've made an IOS build on Unity for an App we're making after adding the facebook SDK, moved the build on a hard drive and tried to build it on xcode on the mac we have at the office, as I always do before uploading it to the app store. I ran into this error and I've been stuck on this issue for 2 full work days and it's driving me a bit crazy, here are the thing's I've tried:
-Install cocoapods, both on the default terminal directory and on the project's directory (I'm not too experienced with cocoapods so I don't know if that made a difference. I also did pod update while standing on the project directory).
-I saw that the IOS resolver has an option called "generate pod files" that people said needed to be checked when building to solve this issue. It was checked by default on my project, so that wasn't it.
-Added the framework path on the build settings to where the facebook SDK is at (though the way it looked on my xcode seemed a bit different than the way I've seen it on other people's xcode screenshots)
-Tried commenting out some #include lines on the headers that are generating the issue. It only produced more errors.
-People said to open the project from the workspace instead of the xcodeproject but unity doesn't seem to generate a workspace file.
-Tried downgrading the Facebook SDK to a previous version but the versions people claim are working don't seem to be on the repository anymore, so it doesn't let me downgrade to them.
At the moment I'm trying to make it work with the latest Facebook SDK which is 9.0.0.
Any help would be appreciated, please let me know if I'm not being specific enough about the issue or if there's any information about my project I should include on the post
The .xcworkspace should be created by Cocoapods, not by Unity directly.
If you already have the Podfile generated, just run pod install on the project directory and open the created .xcworkspace file after Cocoapods finishes installing the external dependencies.

Missing Frameworks from Cocoapods after switching computers

I recently switched computers and brought over my project but when I opened the workspace I noticed that all of my frameworks via Cocoapods were missing.
I closed the workspace and went into the folder directory and deleted the current xcworkspace, 'Pod' folder, and podfile.lock file, and ran a pod update and pod install. I also deleted the Derived Data for safety measures. However, after reopening the newly created workspace the frameworks were still missing and I am getting an error saying that functions that are within my frameworks have been renamed.
Can anyone point me to another solution? I feel like I've tried just about everything that I could find on here and what I know. Thanks in advance!
Missing Frameworks
Framework Incorrect Full Path
Function Renamed Errors
The frameworks are probably missing because they've not been built yet, but they will show up the first time you run the project.
The function rename warnings are probably because you're using a newer version of Xcode that is using Swift 4.2 by default. Usually the easiest way to tackle this is to upgrade your Pods to newer versions.

Xcode 9 - linker command failed with exit code 1

While compiling the application getting as following error
" compiled with older version of Swift language (3.0) than previous files (4.0) file "
Could you please help me?
Use the xcworkspace to build instead of the xcproject?
This usually happens when using Cocoapods and you are building from the xcproject which doesn't know about the cocoapod libraries.
Delete the derived data and do a clean build.
And if you are building a framework, make sure you've selected Generic IOS Device while building or set the Build for Active Architecture only as true in Build Settings.
I think this happens because you changed your app name or maybe the target
look to solve this problem see your target in Podfile
and then come back to your xcode in the targets
select your target app and in linked Frameworks and Libraries (the last one down) see if there's
any pods with light color and a strange name than your target in the podfile
and remove it using the minus button down .
I'd rather fix the specific problem, but if none of the other answers worked a full reset can solve it. If you are getting this error and you are also getting error readouts that refer to "duplicate symbol files", AND all other efforts have failed, then a full reset could work for you.
What worked for me:
Read the error report to identify the repo that supposedly contains duplicate files.
Drag repo to the trash.
re-clone your repo.
set up your repo with correct remote tracking. git remote add <url.git>, or git remote set-url <url.git>
This absolutely worked for me. In my case for some elusive reason, when I ran git pull upstream develop for a local dependency, git would pull in/generate duplicate files from multiple commits.
After following the above steps, the issue went away and git pull upstream develop was no longer pulling from multiple commits at once. Perhaps there was a weird git cache for my repo.
I had the two copies of files in the codebase. Deleting one copy helped code to build successfully
I am probably late for you, but for future devs in problems...
If you have been manipulating the podfile or creating new targets or maybe changing the name of any of them, check that in build phases options your just have correct pod framework for the name of the targets.
if you have pod
first clean project and close Xcode then open terminal and go to folder of Project then pod update
open the project and run
in my case work!
I fixed this problem today by running the app in the simulator using the target associated with the bundle file named in the Build Settings-->Bundle Loader setting of the test target. Previously I had deleted my derived data folder while working on a different target that has a different Product Name than the one associated with the test target bundle file. Rerunning the app in the simulator must have recreated the bundle file in the derived data folder that the test target is looking for and then my tests started running fine.

Firebase Unity xCode linking errors

I am having issues trying to make a build from Unity (version 5.5.2f1) with Firebase Auth / Database imported. I am using the newest Firebase SDK of 3.0.0.
The errors I get are as follows:
I believe it has something to do with cocoaPods. The XCode project compiles with a podfile. And the errors I believe are related to missing libraries? But all the required libraries are set to iOS, and are included with the XCode project.
Unsure of what to try next. Thanks in advance to anyone able to help.
When you build and run from within unity, it tries to run the pod installation for the dependencies needed, and patches the xcode project file (not workspace).
If there is an error with this process, you should see it in the console.
Normally pods are meant to be used with the workspace file, but since unity automatically opens the xcode project the plugin tries to make it work.
Try opening the .xcodeproj instead of the workspace.
So I finally figured out my issue. I had a previous build that worked all the way through to my device. So I eventually tried opening that one again, and I ran into the same errors with an older build.
So that got me thinking.. Why would a previous build that used to work fail this time around?
I came to the conclusion that the only things that changed were possibly me updated Unity to 5.5.2f1. So I updated again to the latest release at this time which is 5.5.2p3, and ran through the same steps:
1) Build to iOS
2) Install pods in the target folder
3) Run xc workspace
And it successfully built. So it must of been something on Unity's side. If anyone ever runs into a similar situation, hopefully this will help.
P.S. I also did update to the latest release (at this time) of Unity Firebase SDK of 3.0.1. Not sure if that had anything to do with making a successful build, but wanted to put that information out there.

Resources