Aamir
Aamir

Reputation: 17007

Unable to find a target named `ProjectName`

I added new pod in PodFile and ran command

pod install

It deleted all previous pods and failed with following error

Unable to find a target named `ProjectName`

However I recovered all deleted pods by using Git, but now my project is not being compiled, it's giving me the following error:

/Users/userName/Library/Developer/Xcode/DerivedData/Project_Name-fhktwvetozjdorboqdzfwlpzrcyw/Build/Intermediates/Project_Name.build/Debug-iphonesimulator/Project_Name.build/Script-D7BB987C75C5AEC6033AA28E.sh:
/Users/userName/Desktop/iOS_Workspace/Project_Name/Pods/Target Support
Files/Pods-Project_Name/Pods-Project_Name-resources.sh: /bin/sh^M: bad
interpreter: No such file or directory

I tried every solution regarding pods, but neither worked for me.
Any help will be appreciated. Thanks

Upvotes: 57

Views: 72092

Answers (10)

Mohmmaed-Amleh
Mohmmaed-Amleh

Reputation: 438

Your IOS Version should be greater or equal 13

Upvotes: 0

ahmnouira
ahmnouira

Reputation: 3461

FIXED

Just I changed App to the correct name of the product which is Mevenda:

target 'Mevenda' do
  capacitor_pods
  # Add your Pods here
  pod 'FirebaseStorage'
end

enter image description here

Upvotes: 0

Lawrence Gimenez
Lawrence Gimenez

Reputation: 3255

If you are here in 2022 using SwiftUI, I just uncomment the line and specified the latest iOS version. I am using Xcode 14.0.1.

# Uncomment the next line to define a global platform for your project
platform :ios, '16.0'

Upvotes: 0

Metin Atalay
Metin Atalay

Reputation: 1517

I have a lot of schemas like below. So, we should map a schema in pod file.

Wrong : target 'MobileBranch' do

Correct : target 'Test-MobileBranch' do

Correct : target 'Main-MobileBranch' do

enter image description here

Upvotes: 0

islam XDeveloper
islam XDeveloper

Reputation: 500

make sure your current name for project in Podfile Matching with right name

target 'Project name' do
  use_frameworks!

  # Pods for Project name

pod 'SwiftMessages'

end

Upvotes: 1

Clean Coder
Clean Coder

Reputation: 562

  1. Take backup of podfile (copy paste at specified location).
  2. Remove pod file. Move to Trash (from) Xcode.
  3. Go to terminal, After locating your pods directory, Hit: pod init
  4. Paste contents from backup-ed file (1st step)...Copy only pod libs. ex. pod 'Firebase/Core'
  5. pod install
  6. Re-start your project then open YourProjectName.xcworkspace.

Upvotes: 2

Aamir
Aamir

Reputation: 17007

After spending hours on Google just opened Podfile and found that project name is wrong. So I have just written correct project name in Podfile and issue has been resolved.

Before:

target 'Wrong Project Name' do
    pod 'Parse'
    pod 'SDWebImage'
end

After:

target 'Correct Project Name' do
    pod 'Parse'
    pod 'SDWebImage'
end

Upvotes: 178

user1105951
user1105951

Reputation: 2287

In my case, the target name was the same,
but it was case sensitive wrong.
"myTarget" // podfile
"MyTarget" // Xcode

Upvotes: 1

Devendra Singh
Devendra Singh

Reputation: 777

It is due to target name changed.

just opened Podfile and replace target name with new target name.

(In my case “GoogleMapSample” was “Map Sample”,

“GoogleMapSampleTests” was “Map SampleTests”,

“GoogleMapSampleUITests” was “Map SampleUITests”,

means I just replace “Map Sample” with “GoogleMapSample” for all targets)

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'GoogleMapSample' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

    pod 'GoogleMaps'
    pod 'GooglePlaces'
    pod 'Alamofire', '~> 4.4’
    pod 'SwiftyJSON', '~> 4.0'


  # Pods for GoogleMapSample

  target 'GoogleMapSampleTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'GoogleMapSampleUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

Upvotes: 4

phi
phi

Reputation: 10733

According to the error, you specify a target named ProjectName but this does not exist in your project. Read the podfile syntax reference carefully and make sure you add the right target name (in my case it's called Tester:)

enter image description here

Upvotes: 14

Related Questions