ios 无法找到名为“ProjectName”的目标

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36365584/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 08:50:32  来源:igfitidea点击:

Unable to find a target named `ProjectName`

iosobjective-cbuildcocoapods

提问by Aamir

I added new pod in PodFile and ran command

我在 PodFile 中添加了新的 pod 并运行了命令

pod install

It deleted all previous pods and failed with following error

它删除了所有以前的 pod 并因以下错误而失败

Unable to find a target named `ProjectName`

However I recovered all deleted pods by using Git, but now my project is not compiling, its giving me following error

但是我通过使用恢复了所有已删除的 pod Git,但是现在我的项目没有编译,它给了我以下错误

/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

/Users/userName/Library/Developer/Xcode/DerivedData/Project_Name-fhktwvetozjdorboqdzfwlpzrcyw/Build/Intermediates/Project_Name.build/Debug-iphonesimulator/Project_Name.build/Script-D7BB987C75C5AEC6033AA28ssk/Project_WorkName:/Delivery/Project_WorkName: 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

我尝试了有关 pod 的所有解决方案,但都不适合我。
任何帮助将不胜感激。谢谢

回答by Aamir

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

在谷歌上花了几个小时后,刚刚打开 Podfile,发现项目名称是错误的。所以,我刚才写正确的项目名称Podfile和问题已得到解决。

Before:

前:

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

After:

后:

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

回答by phi

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

根据错误,您指定了一个名为的目标,ProjectName但这在您的项目中不存在。仔细阅读podfile 语法参考并确保添加正确的目标名称(在我的情况下它被称为Tester:)

enter image description here

在此处输入图片说明

回答by Devendra Singh

It is due to target name changed.

这是由于目标名称已更改。

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

刚刚打开 Podfile 并用新的目标名称替换目标名称。

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

(在我的例子中“GoogleMapSample”是“Map Sample”,

“GoogleMapSampleTests” was “Map SampleTests”,

“GoogleMapSampleTests”是“Map SampleTests”,

“GoogleMapSampleUITests” was “Map SampleUITests”,

“GoogleMapSampleUITests”是“Map SampleUITests”,

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

意味着我只是将所有目标的“地图样本”替换为“GoogleMapSample”)

# 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

回答by user1105951

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

就我而言,目标名称是相同的,
但区分大小写错误。
"myTarget" // podfile
"MyTarget" // Xcode