Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 280
Aamir Avatar asked Apr 01 '16 20:04

Aamir


3 Answers

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
like image 138
Aamir Avatar answered Nov 14 '22 17:11

Aamir


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

like image 38
phi Avatar answered Nov 14 '22 17:11

phi


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
like image 3
Devendra Singh Avatar answered Nov 14 '22 15:11

Devendra Singh