Cocoapods Errors : Resource.sh not found - objective-c

Folks,
Cocoapods : 0.39.0
FYI I have done enough research and I was able to take care of errors like:
Podfile.lock not found.
.menifest not found
and others while building my project.
Which still seem hack to me but as long as they let me build I dont care.
But one real problem is this :
Pod-resources.sh not found and this one is in the pod directory.
so for sure Its not in my source control as I dont check in pods dir into my project.
I have done more than enough weokspace deletion, podlock deletion, who pods dir deletion and pod install. but this problem is still there.
I am using apptentive which has a resource bundle, which need to be copied to the app binary.
At the moment I have disable Apptentive thru out the project to speed up the development and keep looking for solution.
Links that I have read are follows :
https://github.com/CocoaPods/CocoaPods/issues/2303
is from July 10, 2014 : seem too old to rely on.
CocoaPods Errors on Project Build
Error:"The sandbox is not in sync with the Podfile.lock..." after installing RestKit with cocoapods
The sandbox is not in sync with the Podfile.lock-ios
Error:"The sandbox is not in sync with the Podfile.lock..." after installing RestKit with cocoapods
How I solved my partial problem : delete workspace file, Pods Dir and .lock file. If this can help anybody.

Culprit was the path. It seem how Cocoapods is handling is different than earlier.
What it dont do is updating your project file for Copy Resources phase:
it seems they have update the path and now it has "/Target Support Files/Pods-ProjectName/" in it.
Older path: "${SRCROOT}/Pods/Pods-ProjectName-resources.sh"
New Path: "${SRCROOT}/Pods/Target Support
Files/Pods-projectName/Pods-Project-resources.sh"
So if you are having same errors like me you need to do is :
remove workspace file
remove .podlock file
remove .menifest file
do Pod install
update the path in build phase in xcode project file as shown above.
Now Build the project/workspace
Hope this will save someone's time.

You might have to add a PODS_ROOT user-defined build setting, as described here.

Related

iOS UI Test Project 'MailCore/MailCore.h' file not found

I did a
git clone https://github.com/MailCore/mailcore2.git
I open the
iOS UI Test.xcodeproj
I run the Build
I get the error
'MailCore/MailCore.h' file not found
I cannot understand why that is happening.
What should I do to get this to build?
Some other sources I have found and followed their instructions are below. None of which fixed this problem.
https://github.com/MailCore/mailcore2/issues/316
https://github.com/MailCore/MailCore/issues/19
https://github.com/MailCore/mailcore2/issues/276
I also was able to open the
mailcore2.xcodeproj
and successfully build each of the targets. Which is interesting that I can do that but cannot build the test project independently.
I also followed the video and read me instructions to add to an existing project and was able to build until I added the
#import <MailCore/MailCore.h>
to one of my files.
UPDATE:
The above process I initiated on my iMac.
On my MacBook Pro after I cloned mailcore2 I opened
mailcore2.xcodeproj
first then did the build on each of the targets.
Then I closed that project.
Opened the iOS UI Test.xcodeproj and did a build on that.
This was successful.
However, I still want to know what would cause the problem with the "file not found"
UPDATE 2:
I removed to trash all mailcore2 code from my iMac.
I created different locations in Finder for doing another clone of mailcore2.
I did the git clone.
I opened mailcore2.xcodeproj
I followed the exact same process of building each target like I did on my MacBook
I then opened the iOS UI Test.xcodeproj and did a build.
I get the same problem of
'MailCore/MailCore.h' file not found
Makes no sense to me how it works on macbook but not on iMac.
You can add in target dependency static mailcore ios(mailcore2).
and add the framework libmailcore-ios.a
Its working.
What I finally did was drop mailcore2 into an existing app I already had started.
To do this I did the following:
I removed all traces of mailcore2
I again followed the instructions in the README and the video help.
This time I followed some instructions from
https://github.com/MailCore/mailcore2/issues/276
The instructions in that link says to add the following to Library Search Path:
$(PROJECT_DIR)/mailcore2/Externals/ctemplate-ios/lib
$(PROJECT_DIR)/mailcore2/build-mac/build/Debug-iphonesimulator
And the Header Search Path to
$(PROJECT_DIR)/mailcore2/build-mac/build/Debug-iphonesimulator/include - recursively
But, that did not work for me. I had to add the HARD CODED PATH to each of those 3 folders.
After doing a clean and build I was then able to add the
#import <MailCore/MailCore.h>
Now it BUILDs completely without error for me.
I will go back and try to add proper relative paths to each of those Search Paths.
Hopefully this helps somebody else with same issue.
FWIW
Had same problem, spend hours trying - nothing worked, not ever hardcoding paths.
Then I stumbled on one issue:
if in XCode\Preferences\Locations I go to Derived Data - Advanced and set it to different locations it always reverts it to Unique, when I go back and check it.
Then I went in File\Project Setting to Derived Data - Advanced and there it was set to Unique. I changed it there to Default and now it does not have that issue anymore!
I delete Derived data, clean project and Start build (Ctrl+B) and I can see now how Build is being created in derived data w/o problems. And that what mailcore needs to function.
And, I checked - no need for hardcoded paths either!
Hope it helps somebody.
PS Another feature maybe useful too - XCode\Preferences\Continue building after error though it did not matter in my case

Should xcworkspace be in gitignore

I am using GitHubObjectiveCGitIgnore
When I go in sourcetree to commit I see :
project.xcworkspace
This file is not ignored using Github .gitignore file.
I am not sure do I need to commit and push this file?
If you're using Cocoapods, I actually find that the answer depends on a few things.
If you just want the project to be compilable and runable "out of the box", then go ahead and check everything in; xcworkspace and all pods.
If there is a pod that you need to modify for some reason and you want to include that change with your project, then check everything in. For instance, I've found bugs that haven't been fixed for one reason or another and it was easier to just fix them myself and check in the pod along with my project rather than wait for the updated pod or integrating the library manually (which is essentially the same result as checking the pod in anyways). Alternatively, fork the repo, push your changes to it, and point your pod to your fork.
If you have no issues with any of the pods and you've verified that everything works with the versions of the pods you've specified, then you don't have to check in the xcworkspace file or pods. Of course, you'll have to run pod install in this case.
There's no hard and fast rule on what to do here. Sometimes it's worth the extra overhead to just check everything in, and sometimes it's not necessary. It depends on what's most convenient for you.
In short yes it should be commited.
I have my xcworkspace file checked in to my repo. If you don't use a workspace it probably isn't needed but as I use Cocoapods this creates a xcworkspace with the original project and the pods project inside of it.
Use a workspace is the correct way on handling multiple project sets/dependencies.
If you have/or plan to have several projects in the workspace (for example sub projects of your project) then you should not add it to .gitignore.
Cocoa pods just adds its own project to the workspace if a workspace exists when you do a pod install.
In general it is safer to include the workspace file in the git commit, even if you exclude pods.
You will have to do a pod install anyway to compile your project so even if you commit a workspace file that already has the cocoa pod project added it wont cause any issues.

How to ignore untracked files when using CocoaPods?

I have a simple project and wanted to include a third party library (CocoaLumberjack) using CocoaPods. After creating the simple Podfile I ran pod install in my project directory. Everything worked fine, except I now have untracked files in my project that are marked with question marks in Xcode:
Is this how it's supposed to be? I don't remember having these question marks when I last used CocoaPods in a different project. Shouldn't CocoaPods automatically set up the correct gitignores for the pods?
CocoaPods doesn't do anything with your .gitignore.
I recommend using GitHub's Objective-C .gitignore (at least as a starting point). Alternatively, just make sure you ignore the Pods directory by adding an entry for Pods in your ignore file:
# CocoaPods
Pods

How to add GitHub's Mantle to Xcode using CocoaPods

I have added GitHub's Mantle project to a iOS 6 project using CocoaPods:
$ pod search Mantle
$ vim Podfile // here I added pod 'Mantle'
$ pod install // this installs Mantle 1.0
Then I have added the ($inherited) variable to the Header Search Paths of project's 'Build Settings' section, before my custom search paths. When importing the Mantle header file Xcode complains with
#import "Mantle.h" // => 'Mantle/MTLJSONAdapter.h' file not found
Am I missing some step? I have other pods installed as well (AFNetworking and SSKeychain) but only Mantle is giving me issues.
I have also added SSToolkit but following the instructions on its 'Getting started', i.e. not using CocoaPods.
Since the problem seemed to be related with the Xcode project/workspace configuration I tried all kind of 'cleaning' solutions:
Delete the Pods directory, the Podfile.lock file and install everything from scratch.
Delete the MyProject.xcworkspace directory and repeat step 1
Enter MyProject.xcodeproj, delete project.xcworkspace and xcuserdata directories and repeat step 1.
Go to the global Xcode directory (/Users/my_user/Library/Developer/Xcode), remove everything related to the project, specially the DerivedData subdirectory, and repeat step 1.
The final step seems to be the final solution, though I cannot tell which file/folder removal did the trick.
Have you added Mantle to your Podfile? You mention running pod install Mantle which doesn't/shouldn't do anything but show an error. ([!] Unrecognized argument:Mantle'`)
After you add Mantle to your Podfile and run pod install you should be able to link Mantle.h directly and there will be a few directories in your xcworkspace and the Pods project. After this you can use #import "Mantle.h" no issues.
I had the same problem, but the problem appears to simply be that my Mantle pod was too old. Changed version to '2.0.5' and pod updated, things work fine.

Cocoapods: how to create own pods for 3rd party library?

I am using Cocoapods, and one of the libraries I use is ZUUIRevealController, currently the version is 0.9.6 in Cocoapods, which is not the latest one, if I want to create my own pods for that, what are the steps for doing it?
Thanks!
To update for everyone:
OK, so all the cocoapods are held inside a big specs repository Here. We want to go down to the ZUUIRevealController part of the repo. We can see just the 0.9.6 which is how cocoapods knows what version it is.
So, fork the cocoa pods spec repository and open the folder in SublimeMate Pro. You're going to want to add the next version to this folder, so let's say you were going to use 0.9.7. Make a folder for that and copy it over ZUUIRevealController.podspec from version 0.9.6.
The new podspec will need some changing as it refers to the git tag "v0.9.6" and ideally you want to use 0.9.7. Now I've checked for you, there isn't a 0.9.7 which means you'll have to create an issue asking for a new tag, which someone has already done.
With the new tag in the repo you can move that tag into your podfile. Then in the Specs directory run pod specs lint ZUUIRevealController which will tell you whether your podspec has passed or failed linting. If you don't do this it will be done automatically on your pull request, and it's likely that it will be me telling you how to fix it.
If it passes, you can then commit that change and submit a pull request to the Cocoapods/Specs repo on github.
To update for just you:
in your podspec, you can set the commit that you want to override the normal podfile's commit with ( for example )
pod 'ZUUIRevealController', :git => 'git://github.com/orta/ZUUIRevealController', :commit => 'd4c9d810e0f0d1982472c8d1d5469841b09854ab'
This may require deleting your Pods directory first as it might have cached the url / commit.