Why does installing a cocoapod create missing files in xcode? - xcode

I installed cocoapods on my machine.
I added a podfile to my project and then ran pod install.
The resulting file structure that xcode picks up, seems to contain a number of missing files in Frameworks and Products.
Is this expected behaviour? I deleted the pod files and directory and recreated them again using pod install. Same result. I started a new project and did the same. Same result.
If this is expected behaviour, what am I looking at here? Why are there missing files? (if indeed that is what the files being red means).
I don't yet know what the "Products" or ".framework" files are for.
My podfile looks like this:
# Uncomment this line to define a global platform for your project
platform :ios, '9.1'
# Uncomment this line if you're using Swift
use_frameworks!
target 'Hospital Demo' do
pod 'HLSpriteKit'
end
(aside: It's not causing my an build errors, and the app so far runs fine. Don't know if it makes any difference, but I'm using swift.)

Related

Using 'GoogleMaps' and 'GooglePlaces' pods, when archiving iOS build receive error for multiple commands produce GoogleUtilities target

Having trouble archiving - I receive a Build System Information error that says
Multiple commands produce '.../Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework':
1) Target 'GoogleUtilities-00567490' has create directory command with output '.../Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
2) Target 'GoogleUtilities-ac14cd06' has create directory command with output '.../Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
I recently updated to the latest version of Xcode (v 10.0). I am also using Cocoapod version 1.6.0.beta.1
Using GoogleMaps pod version 2.7.0, GooglePlaces pod version 2.7.0
When I run 'pod install' it also installs 'GoogleUtilities (5.3.0)'.
I tried deleting my Podlock, Podfile, .xcworkspace, etc and starting over with a new Podfile, pod init, pod install, etc. after updating Cocoapods but still no luck.
I'm looking for a duplicate relating to GoogleUtilities or Places or Maps in Build Phases within Embed Pod Frameworks, but not having much luck. When I look inside the Pods folder, I do see two GoogleUtilities frameworks, "GoogleUtilities-00567490" and "GoogleUtilities-ac14cd06", but both appear not to have the exact same contents.
Only now experiencing this issue after updating Xcode to version 10.0.
For me, the same issue was coming and Most of the people saying to change the build system to legacy, but when I tried its It started swift compilers error. resolved as mentioned below.
Go to your target and click on (your_app_name_target).
Select Build Phases.
Expand Copy Pods Resources.
See the section Output Files.
This section should be empty. Remove any entry there.
Rebuild your Project.
Going to File > Workspace Settings and then changing the Build System from "New Build System (Default)" to "Legacy Build System" will allow you to archive for now. Hopefully, another solution comes along for using those pods and the new build system in Xcode 10.0

Multiple targets for project in xcode

I am using xcode 7.3.1. After pod update, it's showing multiple project target in the project having same details without any change. How can I fix this? If I delete any one of these, xcode crashes and when we reopen even the other option comes in red and we dont have any project.
Have you tried to delete the workspace file and the pod directory, and re-launch a pod install ? The workspace file does not hold any important information to be retained in CocoaPods.
If you have the same problem after regenerating, it means there is an error in the Pod file.

Importing Alamofire 3.4 - No such module 'Alamofire'

I hava a project that need Alamofire imported and every aproach i took got me to same porblem
import Alamofire - No such module 'Alamofire'
Installed cocoapods
Edited Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'my project name' do
pod 'Alamofire', '~> 3.4'
end
$ pod install
everything was smooth and had no errors in the proces from installing cocoapods to the end.
Opened project with projectname.xcworkspace
Even tried the manually and still the same problem - No such module 'Alamofire'
Thank you for the help in advance.
After adding a framework through CocoaPods, in most conditions you are supposed to clean and build the project right away.
That should take care of adding/building the new framework to your app and make it active for use
Also, please note that another copy of your project will be created upon addition with pods, called something like 'yourProjectName.xcworkspace' (You can find it in your directory). It will have a light blue color thumbnail. After adding your pods, you must start using that copy of your project instead of the normal project.
// Note : Generally with CocoaPods, when you add a pod to your Podfile, you just need to save the Podfile and type 'podinstall' in your terminal. Make sure to get to your project directory before that. That will import the frameworks automatically. However, you do need to write import statement in your file to use it obviously
You do not need to import Alamofire framework explicitly (if using Cocoa Pods) - Umair (in comments)
Do import Alamofire and then do Build. I think it's helpful.
I had a similar issue and solved it following the below listed steps:
Realized that <projectName>.xcworkspace is what you need to be using after adding a pod to your project
Deleted the pods folder and Podfile.lock and did a pod install
Set Architectures to Standard architectures (armv7, armv7s, arm64)
Set Build Active Architectures Only to Yes
I Faced the Same Issue During the Implementation
Step 1 :
Import Alamofire
Step 2 :
Keep on Pressing Build ( Cmd + B )
Step 3:
If Issue Continues then just close your program for a moment by
completely closing it(cmd + Q) and then Restart it and Follow Step
1 & 2
This will work
Thanks
If you install dependencies using Pods, and if you are working using .xcodeproj file, it will never build prompting no such module error. You should definetely switch to .xcworkspace and you will see everything's fine. If the error persists, you should clean the project or delete derived data.

File headers are not being found in Xcode project

i just bought the newest imac.
running OS 10.9.5- 64 bit
I am using cocoapods version 0.34.1
xcode latest stable build (6.01)
And for some reason the repo ive been working on for a year now is having all kinds of trouble finding pod header files.
for parse, im getting 'Parse/Parse.h' file not found,
I could be wrong but i dont think its specific to parse.
Nothing is different about my project environment except for the new computer.
If you are using pod 'Parse-IOS' change it to pod 'Parse', '~> 1.4' because has been deprecated.
Also, does it happen for pods to not been found by ProjectTests?
If so, add at the top of the podfile this line:
link_with ['ProjectName', 'ProjectNameTests']
and at your project Build Setting->Other Linker Flags, add $(inherited).
If you dont need the test target, remove it from the build to solve this.
Go to edit scheme under project and expand all the items in the left column. Highlight any references to test and hit the minus button.
This information can save you from banging your head into the wall.

How do I configure my project for Cocoa Pods correctly?

In some of my past projects, Cocoa Pods wasn't configured correctly and it would lead to undesirable things such as needing duplicate Cocoa Pod projects in the Project Navigator, or pod files having to be checked in to version control.
How do I install Cocoa Pods correctly and verify that my Directory structure and Project Navigator structures are set up properly?
The best way to use Cocoa Pods is to follow the official example's lead.
This consists of several steps.
Setting up Cocoa Pods for the first time
1. Install Cocoa Pods on your computer
Begin with the Getting Started Guide to install Cocoa Pods on your computer.
2. Create a Podfile
Do not create the Podfile in Xcode, since it should not be part of your project!
Create the file in your favorite text editor, and save it at the same level as your .xcodeproj file.
An example of a Podfile's contents are:
pod 'CupertinoYankee', '~> 1.0'
3. Run pod install
Navigate to your Podfile's directory in terminal and run pod install.
4. Open the generated workspace
Once you run pod install, you will see a message such as:
[!] From now on use MyProject.xcworkspace.
Close the Xcode project, and open up the generated .xcworkspace file.
Understanding the Changes
It is always useful to know what changes were made to your project in case things go wrong.
1. Directory structure
You should have started with a structure such as:
... then manually added a Podfile:
After running pod install, your directory structure now looks like this:
Notice how the only new objects are:
MyProject.xcworkspace
Podfile.lock
Pods
2. Project Navigator
In Xcode, you started with this:
... and ended with this in the new workspace:
For reference, here is an expanded look at the new directory structure:
Obviously, the Pods project was added to the Project Navigator, but there are a few other key things to notice:
Notice how Podfile is located at the root of the MyProject folder in Finder, but is inside of the Pods project in Xcode's project navigator.
Likewise, notice how Pods.xcconfig is located inside the Pods folder in Finder, but is inside of the MyProject in Xcode's project navigator.
3. Configurations
These are the same screenshots as before:
In Xcode, you started with this:
... and ended with this in the new workspace:
Notice how under Configurations, the "MyProject" target now has Pods specified.
This is important because otherwise PODS_ROOT will not be set up properly (among other things), and when you build, you will get errors.
4. PODS_ROOT added
Your target's Build Settings went from this: (Note: this is scrolled all the way down)
... to this:
Notice how PODS_ROOT was added as a User-Defined setting.
Note: this part of the configuration sometimes gets bugged out when reinstalling Pods, so you may need to close and open the Xcode project to fix it.
5. Other changes
You can see a complete list of the changes here.
In my case: On my project SwiftLint was added on Build Phasees -> SwiftLint as below image My root Folder structure was Volume/Project Files/iOS Project Files/Office Projects/project-name. As you can see there were space on my Directory structure , SwiftLint executed on build phase create problem for those space and show a no directory found error. After changing the high level directory by renaming like the below image solved my problem

Resources