XCode:4.6 Lion:10.8 IOS 6.1 错误:SBTarget 无效

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14579666/
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-09-15 02:39:35  来源:igfitidea点击:

XCode:4.6 Lion:10.8 IOS 6.1 error: SBTarget is invalid

iosxcodeios6xcode4.6

提问by alexqinbj

XCode:4.6 Lion:10.8 IOS 6.1 error: SBTarget is invalid , how to solve this?

XCode:4.6 Lion:10.8 IOS 6.1 错误:SBTarget 无效,如何解决?

回答by alexqinbj

After hundreds of times testing, I find a way that can help the programme run, here is it:

经过数百次测试,我找到了一个可以帮助程序运行的方法,就是这样:

  • When you first meet SBTarget is invalid, choose Product --> Clean
  • Run again, this time you may also get error: SBTarget is invalid, it doesn't matter.
  • Turn off the XCode totally, 'totally' means that the Xcode icon should not appear in the Dock.
  • Double click your project file(xxx.xcodeproj , the blue one) to start Xcode, run again. (Do not Clean this time), and it runs ok.
  • 当你第一次遇到SBTarget is invalid 时,选择Product --> Clean
  • 再次运行,这次也可能会报错:SBTarget is invalid,没关系。
  • 完全关闭 XCode,“完全”意味着 Xcode 图标不应出现在 Dock 中。
  • 双击你的项目文件(xxx.xcodeproj,蓝色的)启动 Xcode,再次运行。( Do not Clean this time),它运行正常。

Let me know if this can help you or you have any other methods. Thx

如果这可以帮助您或您有任何其他方法,请告诉我。谢谢

回答by ColossalChris

I had this issue while incorporating the Facebook SDK into my app. The error would alternate between SBTarget is invalid and telling me that my architecture was incompatible with my device so it would not launch. If I followed alexqinbj's advice it would run the app once but then it would go right back to having the same error again. I tried messing with architectures and build settings and removing derived data but in the end it really was just a duplicate file in my file structure. Facebook told me to add their SDK and then to add a folder (that the SDK file already contains). Once I saw that it was just a matter of removing the duplicate file. I've heard of this error happening with duplicate plists as well. Good luck

我在将 Facebook SDK 合并到我的应用程序中时遇到了这个问题。该错误会在 SBTarget 无效并告诉我我的架构与我的设备不兼容因此无法启动之间交替出现。如果我遵循 alexqinbj 的建议,它会运行该应用程序一次,但随后又会再次出现相同的错误。我尝试弄乱架构和构建设置并删除派生数据,但最终它实际上只是我文件结构中的一个重复文件。Facebook 告诉我添加他们的 SDK,然后添加一个文件夹(SDK 文件已经包含)。一旦我看到这只是删除重复文件的问题。我听说重复 plist 也会发生此错误。祝你好运

回答by julius patta

Indeed, the root cause (in Facebook integration) is the duplicate resources in the Facebook SDK (as per their instructions). When I deleted the resource files (remove references only), this problem went away permanently. Not sure why Facebook instructions ask you to drag the resources bundle over to the Facebook SDK framework you just brought in...

事实上,根本原因(在 Facebook 集成中)是 Facebook SDK 中的重复资源(按照他们的说明)。当我删除资源文件(仅删除引用)时,这个问题就永久消失了。不知道为什么 Facebook 指令要求您将资源包拖到您刚刚引入的 Facebook SDK 框架中...

回答by TK189

TARGETS -> Build Phases, remove info.plistfrom Copy Bundle Resources. Clean and run. It works for me.

TARGETS -> Build Phasesinfo.plist从 中删除Copy Bundle Resources。清洁并运行。这个对我有用。

回答by Michael Labbé

Unfortunately, the accepted answer didn't work for me. I can provoke this error with 100% certainty. It is not necessarily an internal consistency issue with XCode that can be resolved through cleaning, rebooting and rebuilding.

不幸的是,接受的答案对我不起作用。我可以 100% 确定地引发此错误。这不一定是 XCode 的内部一致性问题,可以通过清理、重新启动和重建来解决。

SBTarget is Invalid is an internal XCode error. It happens when attaching a debugger and the architectures specified in the XCode project do not match up with the binary.

SBTarget 无效是一个内部 XCode 错误。当附加调试器并且 XCode 项目中指定的架构与二进制文件不匹配时,就会发生这种情况。

On OS X, you can diagnose this by going to the binary on the hard drive and typing:

在 OS X 上,您可以通过转到硬盘驱动器上的二进制文件并键入以下内容来诊断此问题:

lipo -info <bin>

Then comparing this to the build settings ARCH and ONLY_ACTIVE_ARCH. They must match. It is not enough for ARCH to be a subset of the possible architectures contained within the binary.

然后将其与构建设置 ARCH 和 ONLY_ACTIVE_ARCH 进行比较。他们必须匹配。ARCH 是二进制文件中包含的可能架构的子集是不够的。

There are any number of reasons why they might not match up. Here are some suggestions:

它们可能不匹配的原因有很多。以下是一些建议:

  • You are using an external build scheme. XCode therefore does not dictate the contents of the binary. The build settings merely tell XCode what to expect when launching GDB or LLDB.
  • The executable specified for launch in the scheme is not correct. If it can't find the executable, the architectures will not be present.
  • 您正在使用外部构建方案。因此,XCode 不会规定二进制文件的内容。构建设置只是告诉 XCode 在启动 GDB 或 LLDB 时会发生什么。
  • 在方案中为启动指定的可执行文件不正确。如果找不到可执行文件,则体系结构将不存在。

回答by Pripyat

This error has a very distinct cause in my case. Whenever "Expand Build Settings in Info.plist File" was set to "NO" in Xcode's "Build Settings", this message came up. Will submit rdar to Apple.

在我的情况下,此错误有一个非常明显的原因。每当“扩展 Info.plist 文件中的构建设置”在 Xcode 的“构建设置”中设置为“否”时,就会出现此消息。将向苹果提交 rdar。

enter image description here

在此处输入图片说明