53
votes

When i type "pod install" in a correct directory I always get this

Analyzing dependencies

[!] Could not automatically select an Xcode project. Specify one in your Podfile like so:

    project 'path/to/Project.xcodeproj'

podfile

platform :ios, '8.0'
use_frameworks!

target 'Posting' do
pod 'ALCameraViewController'

end

I'm in the project directory where Podfile can be found.

22
Add your podfile in the question.Dershowitz123
how did you create the podfile?Akshansh Thakur
Are you running $pod install in your project directory?Dershowitz123
YES I am sure @Dershowitz123kvra13
@kvra13: Whether your project have a target named "Posting" ? Check by removing the target line and end lineMidhun MP

22 Answers

121
votes

I had an old .xcodeproj-file in my folder, so there was 2 of them. I removed the old one and it works!

17
votes

Add your Podfile to project line for Specify project path

target 'MyGPSApp' do
  project 'FastGPS'
  ...
end

details: https://guides.cocoapods.org/syntax/podfile.html#project

13
votes
platform :iOS, '8.0'
use_frameworks!

target 'Posting' do
project 'projectpath/project.xcodeproj'
pod 'ALCameraViewController'
end
11
votes

This happened to me, I had my "podfile" in the subfolder and not the main directory, e.g., ~/MyProject/MyProject/podfile instead of ~/Myproject/podfile

Hope this helps!

5
votes

It is taking single declaration for each target. Add line at top of the file after platform:

project '<Project>.xcodeproj'

target '<Project>' do
 #bla bla bla
end

target '<Project>-tvOS' do
 #bla bla bla
end

5
votes

Mistakenly added two .xcodeproj file in the project folder.

This is why pod did not decided which one he will work for. I simply delete the unnecessary xcodeproj file from the project.

Now Solved

4
votes

I had 2 files with .xcodeproj along with 1 .xcworkspace, inside my project folder. I deleted one and problem got resolved.

In my case, I removed the one whose size was zero bytes.

4
votes

I have got this error when I have moved my repo to an external drive.

My solution was to move the repository to the main drive.

3
votes

To address this, you'll need to add the correct path to your project.xcodeproj. Having this one fixed, It's very likely you'll need to provide the path to your project.xcworkspace. The code below addresses both issues.

target 'your-app-bundle-name' do

platform :ios, '8.0'
workspace 'path/to/your/project.xcworkspace/'
project 'path/to/your/project.xcodeproj/'

pod 'ALCameraViewController'

end
2
votes

Oddly I had 2 .xcodeproj files in the same directory . I think i duplicated one. It showed up in the workspace as red, When I removed one it worked fine .

1
votes

I had this issue when I accidentally deleted '.xcodeproj' file.

1
votes

You should specific project path inside pod file

platform :ios, '8.0'
   use_frameworks!

   project 'PATH_TO_PROJECT/YOUR_PROJECT_NAME.xcodeproj'
    target 'Posting' do
    pod 'ALCameraViewController'

end
1
votes

I had my project stored in the Icloud and when I moved it to my desktop, the terminal found the project and allowed me to install the POD.

1
votes

I solved the problem as follows new Podfile

pod init
pod install
1
votes

This seems to be an issue with an additional file being added to Xcode. In case you are trying to troubleshoot, it makes sense to look at any additional files you may have added. Either on Xcode or directly in your file.

In my case it was this: /node_modules/react-native-gesture-handlers/ios/RNGestureHandler

After deleting this I hit pod install, and it worked fine.

1
votes

For me below solution worked

Since Podfile and .xcodeproj is at same level, I added project 'oceanview.xcodeproj' at top of the file.

So my podfile looks like below,

platform :ios, '9.0'
project 'abc.xcodeproj' #added this line
target 'abc' do
end

then run command pod install

0
votes

Did you include the entire ALCameraViewController repository in your project folder? I did that initially, and I got the same error. Go back to the repo and follow the README.md file step by step.

If you did include the entire repo, I would also advise to remove all the folders that you included in your project that came from the ALCameraViewController repo. Then try to install the repo in the Podfile again, the error should be gone.

0
votes

I had the Same problem , i solved it by moving the podfile to the main project folder , in your case : 1- move the pod file to 'Posting' folder , in which there are 'Posting' subfolder and 'Posting.xcodeproj' file
2- re run the ' pod install ' command. 3- enjoy

0
votes

I had the same issue, the problem was in that my project folder was synchronized with iCloud and .xcodeproj wasn't fully loaded from it. It was visible in Finder but not visible in Terminal. The solution was to open/close .xcodeproj and try "pod install" again

0
votes

I had a conflict because we were working in a team and I had a manifest.lock file under my pods directory that I had to remove and then run the pod install command and it worked :)

0
votes

This happened to me too. We use git. And often change branches. While I changing a branch, some bug in Xcode made the project file lose its name. I did clean and changed branches or pull again. The Xcode project file was restored. But the old file with the missing name was still in there. This is not detected by git, if you try to do a pod update with this file in there, It will file. Delete this file or make sure you have only xcode proj file. This should fix it

0
votes

For the newer versions of xcode (ie 12.4 and above), use this target instead:

  post_install do |installer|
   installer.pods_project.targets.each do |target|
   target.build_configurations.each do |config|
   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
  end
 end
end

NOTICE that for this solution we are using version 10.0 as our target. Good luck