Pergunta

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

Foi útil?

Solução

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.

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

Outras dicas

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

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...

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

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.

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.

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

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.

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.

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.

enter image description here

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top