Strange errors when Archiving iPhone app - ios

So I am trying to archive my iPhone app for ad-hoc testing and I am getting some weird circumstances. When I archive it, at the top where it says archive type, for some reason it says "Mac app archive" instead of the usual "iOS App Archive"
I do not know why this is happening, because this is not a mac App.
I have the following three warnings when I archive the app that may help, but I'm not sure.
The first is this one
iPhone/iPod Touch: application executable is missing a required architecture.
At least one of the following architecture(s) must be present: armv6 (-19033)
I am not sure why this is happening, because I have both armv6 and armv7 listed in valid architectures
The second warning I get is this
The CodeResources file is missing and it must be a symbolic link to
_CodeSignature/CodeResources. Make certain that the bundle is on a locally-mounted volume
(not a remote SMB volume), and be certain to use the Mac OS X Finder to compress it
(-19062)
Again, not sure why this is happening, or even what it means.
The last error is this one
Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Catch It/Resources/Info.plist'.
I am really lost on that one, I don't know what it is trying to tell me.
Please help me, because I cannot distribute this ipa because it thinks it is a mac app.
Thanks

I guess you are using Xcode 4.5.
I've just run into the same problem, and managed to solve the problem. My app is waiting for review now.
This is what I changed: In the target, I selected "Build phases", then in "Copy bundle resources" I removed the plist file.
If this doesn't fix your problem, also make sure you set the iOS deployment target to iOS 4.3 at least.
Edit: I also removed armv6 from both Architecturesand Valid Archictectures in the build settings.

I get message on Xcode 4.6.3
The CodeResources file is missing and it must be a symbolic link to
_CodeSignature/CodeResources. Make certain that the bundle is on a locally-mounted volume
(not a remote SMB volume), and be certain to use the Mac OS X Finder to compress it
(-19062)
when try Build app, after running it on Simulator. Change target to iOSDevise solve this problem.

Related

Simulator fails with (LaunchServicesError error 0.) [duplicate]

This question already has answers here:
Unable to run app in Simulator : An error was encountered while running (Domain = LaunchServicesError, Code = 0)
(19 answers)
Closed 5 years ago.
I received an error (Domain = LaunchServicesError, Code = 0) when trying to launch my app in the iOS Simulator with Xcode 6. I looked for solution in google, but I didn't find anything practical.
What does this error mean?
This error indicates that there was a problem with installation. Unfortunately, Xcode does not actually print the contents of the error message that would give you more insight, but you can look at ~/Library/Logs/CoreSimulator/CoreSimulator.log to see the rest of the error details. There will also be more information about the problem in the simulated device's system log (~/Library/Logs/CoreSimulator/[Device UDID]/system.log); look for messages from installd around the time of the error).
Common causes for this include bundles missing an Info.plist, missing keys within your bundle's Info.plist, or values for some keys in the Info.plist not being allowed.
If your app's Info.plist does not contain a valid CFBundleVersion key/value pair, it is possible that your app may install correctly the first time but fail to update. Many users seem to work around this by doing a "Reset Contents & Settings" after each install, but it would be better to fix the root cause by setting an appropriate CFBundleVersion in the Info.plist. I believe iOS 8.2 now correctly returns an error on the first install in this case rather than just on updates, so hopefully this problem will be more obvious now.
Users with home directories on file systems that do not support hard links (eg: network home directories via AFP, SMB, or some NFS servers) may also run into problems related to hard linking. If this is the case, I suggest you create a path on your local HFS+ filesystem for simulator development (eg: /var/simulator/[user]) and create a symlink to that path from ~/Library/Developer/CoreSimulator. This particular issue was fixed in one of the iOS 8.2 betas.
In another case, the Build&Run would always succeed on the first try, but subsequent attempts would sometimes fail due to a changed Info.plist (eg: because someone's build system settings result in CFBundleVersion being different on each iteration). You can usually recover by either deleting the installed app (using a long-press from the home screen or xcrun simctl uninstall [Device UDID] [app identifier]) or erasing the device back to a default state. To erase the device, execute xcrun simctl erase [Device UDID] from terminal or choose Erase Contents & Settings from the iOS Simulator menu. This particular issue was fixed in one of the iOS 8.2 betas.
A newer instance of this issue is occurring for Xcode 6.2 users. If you have a WatchKit App Extension bundled in your app, it will fail to install to versions of the iOS Simulator runtime older than iOS 8.2. As a workaround, you will need to manually disable the app extension from installing when you want to test with iOS 8.1 and earlier runtimes.
If you need more specific help, please provide the entirety of the error message from CoreSimulator.log and any messages from installd and CoreSimulatorBridge that appear around the same time in ~/Library/Logs/CoreSimulator/[Device UDID]/system.log as that will reveal the underlying problem.
Does your project include a widget or extension? If so, the problem could be the bundle identifier of your widget/extension. It should be the same as the main target, appended with a period and an extra string. So for example:
Main target: com.mycompany.myapp
Widget should be: com.mycompany.myapp.widget
I fixed it by resetting the simulator:
iOS Simulator > Reset Contents and Settings...
Since everyone writes what they went through and how they fixed their exact problem, that might be unhelpful.
The problem is that there are different causes for the same error message and the right way of solving it is to open up ~/Library/Logs/CoreSimulator/CoreSimulator.log and look in there for the last message. This message gives you a good clue and sets you on the right path of solving your problem (sometimes it's bundle IDs, sometimes it's a missing or an extra attribute in the Info.plist, but you always get a good, descriptive clue).
This is how you narrow down the problem and eventually get to fix it.
Good luck and tough nerves with Xcode .)
Z.
For me I just cleaned the project and it worked -> Product -> Clean
TLDR: Clear your Project Build Folder - and you will be free of this pain.
( plus I logged this as a bug with Apple as they need to find a way to fix this in Xcode )
None of these solutions worked for me - I banged my head against several walls.
I looked at the CoreSimulator log and I realised that it was trying to build a library that I had deleted.
I couldn't find references to it anywhere.
Then I saw via another SO Question which unfortunately I can't find to reference, if you:
Hold down your option key then Product-> Clean option becomes Clean
Build Folder
Press that and enjoy having your error vanish
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
In XCode 6
An error was encountered while running (Domain = LaunchServicesError,
Code = 0)
I had this error after making some major code changes to accommodate the iPhone 6 Screens. in Xcode 6 (iOS8)
I followed the options above and found that the only way to really get this fixed was by doing the following:
Deleted the derived data [go to Window >> Organizer >> (Find your App) Click on Delete next to the Derived Data]
Product >> Clean
Reset Contents and Settings in Simulator
Changed the Bundle Version to 1.4.1 from 1.4 in pList
Thank you for all the previous answers that got me to this stage. It worked a charm!
In my case, the error was caused because i didn't set the build id.
Setting this, launches the emulator without problem.
One other thing to try, that worked for me, after resetting the simulator and doing a clean build did not help, is clearing out the derived data. To do this: go to Organizer click on project click on delete derived data button. I had this happen after working on an extension for a while and went back to the regular branch. Hope this helps.
This is what caused the problem for me: the build number for the main app and the extension were different (I had incremented the main app build number to 1.0.1.03, but left the extension at 1.0.1.02).
Making them match fixed the problem for me.
Open the Console app and look there. In my case it told me exactly what to do. I saw:
ErrorDescription=WatchKit 2 app extension's NSExtension.NSExtensionAttributes.WKAppBundleIdentifier value does not match WatchKit app's bundle ID (found "com.myCompany.MyApp.MyApp.watchkitapp"; expected "com.myCompany.MyApp.watchkitapp").
So, I went to each plist and checked any items that related to a BundleID. Then Clean, relaunch, etc.
My case was about framework compilation. I have enabled the 'copy only when installing' option from Target- Build Phases- Embedded Frameworks-
I have an app that is set up to use different bundle IDs based on the build configuration. When creating my Apple Watch extension, Xcode generated everything using my Release ID, so I had to go through and change it all manually for debugging. Here's all the places I had to change it:
WatchKit Extension's Build Settings -> Packaging -> Product Bundle Identifier
WatchKit Extension's Info.plist -> NSExtension -> NSExtensionAttributes -> WKAppBundleIdentifier (this needs to use the same prefix as your companion app)
WatchKit App's Info.plist -> WKCompanionAppBundleIdentifier
The last one took me a while since the WatchKit App's Info doesn't show up as a tab when viewing the target settings, I had to go direct to the Info.plist file itself.
Try putting some number into [TARGETS]-[General]-[Identity]-[Version(or Build)], if they are empty.
It worked for me.
I hope it will help you.
I also have this error. In my case the log ~/Library/Logs/CoreSimulator/CoreSimulator.log was something like that :
Could not hardlink copy /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Containers/Bundle/Application/70F24DDC-7954-46BF-B799-F807FD98yyyy/myApp.app to /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Library/Caches/com.apple.mobile.installd.staging/temp.kOrJ9G/extracted/Payload/myApp.app with manifest /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Library/Caches/com.apple.mobile.installd.staging/temp.kOrJ9G/extracted/com.apple.deltainstallcommands.com.mycompagny.myapp
thanks to this answer In look at my app info.plist. the key CFBundleVersion was missing so I add it and now everything is working !
None of the above worked for me, but this did:
I simply deleted IceCream.xcworkspace/xcuserdata/xcuserdatad and then reset the simulator and ran the app again. (Reseting the simulator alone, did not work for me.)
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
The great explanation by Jeremy at least set me in the right direction, but despite having all the bundle identifiers and versions set correctly, the error still persisted. I then checked the Apple documentation which shows that the WatchKit extension (in its Copy Bundle Resources phase) copies the WatchKit app. This WatchKit app was named exactly the same as my iOS app, causing Xcode to confuse the two and read out the wrong plist, thinking the bundle identifier was incorrect. Renaming the Product of the WatchKit app to something distinct finally solved it for me.
If you've changed your bundle ID, make sure you do a clean build before trying to build it again! See how here: How to Empty Caches and Clean All Targets Xcode 4
So it's definitelly .plist problem. In my case it was empty NSExtensionMainStoryboard, removing this property fixed the problem
I had this error whilst trying to build Apple's Lister Xcode Project and run it on the simulator.
The essentials which fixed it for me were:
1) BundleID for the iOS App and the iOS Extension had to be different
2) I provide iCloud and App Groups for both targets
3) I used Xcode's "Fix Issue" to fix the issues
After that I could build and run the app without warnings or errors.
The clue from the log file was "... LegacyErrorString=DuplicateIdentifier, FunctionName=-[MIInstallableBundle performPreflightWithError:], SourceFileLine=450, NSLocalizedDescription=The parent bundle has the same identifier (com.ACMECompany.Lister) as sub-bundle at /Users/stephen/Library/Developer/CoreSimulator/Devices/5329928B-946B-40A4-B666-EFD11B96D11F/data/Library/Caches/com.apple.mobile.installd.staging/temp.HQ5d9X/extracted/Lister.app/PlugIns/Lister.appex"
Had a wrong app version set in InfoPlist.strings localization file. Urgh!
An hour gone!
Delete your simulator and regenerate one.
It works for me.
I removed the key in watch app's .plist file that shouldn't have been there. And the problem disappeared.
This worked for me:
In project settings -> General tab -> Identity section I changed the Version number from something like 2.0.2 (three digits) to 2.0 (two digits) then I deleted the app in the simulator and run the project again. No more error after that.
One other possible solution to add to all of the others that will no doubt stay above mine ;)
I deleted & later reinstated a Today Extension target retaining the source files, but after trying every solution under the sun, I realised it didn't have any sources or resources in its target! You might encounter this as well if your detailed launch services error can't find your compiled app extension file.
So, long story short, make sure your target has something included to compile or bundle in there. You can check your target memberships by selecting the relevant file(s) on your project navigator (on the left) and setting your checkmark(s) as appropriate in the file inspector (that's the first tab on the right).
I had the following in my log...
<Error>: Error Domain=LaunchServicesError Code=0 "(null)" UserInfo={Error=ExecutableTwiddleFailed...
This was due to there being no source files added in the extension project.
This error was showing up on my system when there was no hard disk space available. I freed up some space on my system for it to work.
My Problem was that the wrapper extension for the target project was unset.
To fix I had to go to target project -> build settings -> Packaging -> Wrapper Extension.
Set this to "app" (No quotes)
This fixed the problem for me

Xcode 6 Archiving and get a warning "Skipping copy phase strip ,binary is code signed" when add "share extension" to target

I got this warning when I added share extension to my project and archiving it
warning: skipping copy phase strip, binary is code signed: /Users/xxxx/xxx/xxxx/Build/xxxx/Build/Intermediates/ArchiveIntermediates/xxxx/IntermediateBui ldFilesPath/UninstalledProducts/XXX.appex/XXXX
The old question does not provide and insight to correct this . So I decided to ask again.
Warning during archive App with iOS 8 Extension in Xcode 6
Can someone please explain why this is happening ? Is it because the extension target is already code signed? If so, how to solve it ?
I knew that setting "Strip debug symbols during copy" to "NO" can clear this warning . But it is not actually solve the problem. And what is the drawback of not "stripping debug symbol"? Because my archive size is still the same whether I set this to YES or NO
Do not disable Strip Debug Symbols During Copy in your application project. This will bloat your app (if you have other unsigned dependencies).
It occurs because building the application project attempts to strip the framework but it can't since the framework is already codesigned. However the framework has already been stripped during it's build, so the warning is harmless. Xcode isn't doesn't seem to detect that the codesigned framework has already been stripped.
You should leave it as is.
"Compiled code usually contains debug information. This debug stuff is
helpful for inspecting running code in debugger, but less so for the
optimized code you would ship in distribution builds. Therefore it
gets stripped out when doing an Archive build.
The problem here is that PBXCp is unable to strip out debug symbols
from signed binaries because this would invalidate the digital
signature. So if you have a project that was created before Xcode 6.3
you will now get a warning like this.
To fix the warning simply change both values to NO. Removing them does
not work because the default value is still YES for both. The project
templates that came with Xcode 6.3 have these turned off by default.
Only projects that were started with older templates still have YES on
the Release line."
Source: https://www.cocoanetics.com/2015/04/skipping-copy-phase-strip/
I experienced the same warning and solved it by setting "Strip Debug Symbols During Copy" to "NO" in Build Settings of the containing app(not the extension), as you knew.
On the other hand, changing the same setting of the extension had no effect. This make clear the actual meaning of the warning. That is, stripping symbol does not mean the symbols "of the target" will be striped, but does mean the target will try to strip symbols "of embedded binaries".
Consequently, I believe the actual meaning of the warning would be that Xcode can't strip out debug symbols of the extension binary while archiving the container app, because the extension binary which need to be embedded in the container app "was" already compiled and frozen by code-signing before Xcode tries to strip out symbols of the extension binary while archiving the container app.
It seems like Xcode's default build settings related to striping debug symbols of the embedded extension binaries needs to be correctly updated not to show this warning.
In my case was related with 2 AppIcons (I forgot the fill them) , check if you have all the AppIcons in the xxx.xcassets file with the right xxpt.
From here I beg Apple to improve this check or enable an auto-tool to complete all the AppIcons set. It is crazy.
If you are using Xcode 9.34.1, click in the project settings. Use the filter to find the correct setting: type "strip debug". You will find the settings COPY_PHASE_STRIP. Probably is set to "Yes". Set to "No" to remove the warning.

Can I debug iOS app installed from IPA archive?

I m having some problem with my app which reproduces only when i install it ad hoc, but doesn't reproduce if i just run the app from Xcode. I would like to debug this problem, but so far i m not having any luck. I m using Xcode 5.1.1. Here is what i did:
1) Go to Product->Scheme->Edit Scheme->Archive and set build
configuration to Debug.
2) Code signing identity is set to iPhone Developer.
3) Generate Debug Symbols is set to Yes.
4) Go to Product->Archive and after it is archived, click
"Distribute", then choose "Save for Enterprise or Ad Hoc Deployment".
5) My development provisioning profile is selected.
6) Click "Export" and export the .ipa file.
7) Use iPhone configuration Utility to install the app onto the
device.
8) Run the app on the device.
9) In Xcode, go to Debug->Attach To Process->By PID or Name, enter the
app name. Xcode attaches successfully and says running the app on
iPad.
10) However, i cannot hit any breakpoints which should be hit when i
do certain actions in my app (if i install and run the app from Xcode
instead, all breakpoints are hit).
Am i missing something?
You don't have any debug information for the app at this point, and since most apps are pretty thoroughly stripped, there won't even be symbols for lldb to hook on to. So we're not going to be able to successfully set breakpoints.
When you built the app, Xcode produced a dSYM file (MyApp.app.dSYM) which has the debug info in it, so all is not lost. Problem is when you attach to some - to Xcode - random app on the device, Xcode has no way to know where to find its debug info.
You can add the debug info into your debug session in lldb by using the command:
(lldb) add-dsym <PathTo.dSYM>
You have to do this after you have attached.
lldb also uses SpotLight to find dSYM's so if you put the dSYM somewhere that SpotLight knows to search (like your Desktop or a folder under your User directory) then lldb should pick it up automatically.
You can tell whether lldb has successfully read in the dSYM by doing:
(lldb) image list <AppName>
If lldb found the dSYM, it will list the path to it on a separate line after listing the path to the AppName binary.
Jim Ingham, thanks for your answers.
I found the reason why i was unable to debug into static libraries. In each Xcode project, there is a setting called "Strip Linked Product" under "Deployment" section. In all my projects this setting was set to "Yes".
In order to debug into static libraries for an app built by archiving, i set this setting to "No" in each dependent library project (as well as the main project). This can also be set differently for Debug/Release modes. After this, i see the library symbols built during archiving and i m able to debug into library code. I hope this helps someone.
Unfortunately (or maybe fortunately) the bug i was trying to debug no longer reproduces when the library symbols are not stripped. Maybe something happens when the symbols are stripped, i will need to investigate further.
I was struggling with the same problem, and just launching my app from Xcode was not an option - I had to build the IPA, sideload it on an iOS device, and then debug. Eventually I was able to make that work with the following steps:
1) Set the scheme archive target to Debug
2) Change the following settings for the Debug builds
Keep Private External Symbols (KEEP_PRIVATE_EXTERNS) : YES
Enable Bitcode (ENABLE_BITCODE) : NO
Strip Linked Product (STRIP_INSTALLED_PRODUCT) : NO
3) Rebuild, archive, and deploy the resulting IPA file to your iOS device.
4) Launch the app, and in Xcode, select Debug/Attach to Process/YourAppName(id)
5) Break into the debugger - you should be able to see the code, put and use breakpoints, etc.
If you want to debug your code from the very beginning, just put a loop that sleeps for a second or two and then checks a flag at the top of your main function - when you break into the debugger, just change the flag to let it escape the loop.

Xcode: Could not inspect the application package

I am running Xcode 6 and iOS 8 GM. Every other time I run my app I get this message from Xcode:
"Could not inspect the application package"
So I can run and build, I will get the message. I run and build again, everything runs as expected (this is to my device). Then it will rinse and repeat, every other time giving me this error.
I have looked at all the other solutions that have been suggested but cannot stop this error. I have cleaned my project, cleaned the build folder, deleted derived data etc with no luck.
How can I see what is causing this in the first place?
Interestingly, this only happens when running on my device. Not on the simulator. Also, it only happens on my device, when building for debug. If I change the scheme to release, I can build and run endlessly without with error. Ideas?
This error seems to happen when you have third party code which isn't signed by you in your bundle. Check this thread, it helped me once.
Also when performing build clean opt for cmd + option + shift + k.
This can happen with Xcode 6 and iOS 8 if a product name contains non-latin characters.
In this case changing product name to the one with only latin characters for debug builds fixes this problem.
Try to remove some libraries from your Xcode => Click on Target => General tab => Embedded Libraries (Keep only required libraries or Framework)
Here, remove (Use - sign on bottom to delete).
If you require the framework or libraries that you deleted, add this using Xcode => Click on Target => General tab => Linked framework and Libraries (Use - sign on bottom to add this).
This will work.
In my case, I needed to check the option that says "Copy only when installing" under "Build Phases/Embed Frameworks" in one of the frameworks I was embedding.
If you have moved or copied a folder named resources or resource into your project, try renaming it. Then perform a clean.
I got this when a custom built .framework was missing its Info.plist.
I deleted my Info.plist and I dragged a new info.plist into my project. Xcode did not show me any warning but my app would not launch until i changed the name to Info.plist.
I've seen this error before when there is something in the entitlements file but is not enabled for the app id in the provisioning centre.
Specifically I had HealthKit enabled in the entitlements file but not configured for the application identifier.
I had a potentially similar problem, hardware only, when I had an app which was given entitlement to run in the background and had run previously on the phone. For such apps, I found the Xcode deployment to phone broken and had to change the bundle identifier to unjam the deployment.
I think there are third party files in your code, which might include compiled code which is not signed by you. If so, you can use iReSign to resign them using your own certificate. You can also use the command line:
codesign -f -s "iPhone Developer: Name (XXXXXXXXXX)" nameOfAppToSign.app
Replace the example identity with your own (you can man codesign to read more about this command).
I had the same issue, And was unable to install the ipa. It always ended with an error "Could not inspect the application package." and some warnings in device console
Feb 10 17:38:16 iPhone mobile_installation_proxy[356] <Warning>: LaunchServices: Please include the kCFBundleIdentifierKey in the options dictionary when installing an app.
Feb 10 17:38:16 iPhone mobile_installation_proxy[356] <Warning>: LaunchServices: installing app with unknown bundleID
.
.
Feb 10 17:38:16 iPhone installd[44] <Error>: 0x101bcc000 -[MIBundle _validateWithError:]: 28: Failed to load Info.plist from bundle at path
Feb 10 17:38:16 iPhone installd[44] <Error>: 0x101bcc000 + [MIInstallable installablesAtURL:packageFormat:userOptions:error:]: Failed to create bundle for …
After spending hours, I got it fixed by adding the "Application requires iPhone environment" in info.plist
<key>LSRequiresIPhoneOS</key>
<true/>
Found a solution by adding the Framework to General -> Linked Frameworks And Libraries and setting the status to optional. (Leave the embedded binaries blank)
deleting Pods and then calling pod install worked for me
Happened to me today. Yesterday everything was working fine and suddenly today I can't deploy because of this error:
Could not inspect the application package.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653103
on Xcode 13.4.1 and iOS 15.4. Nothing changed from yesterday. Tried to rebuild the project (not helped), relaunch Xcode (not helped), restart the phone (not helped) and rebooted my MacBook (not helped)...
Then I remembered that I merged the .project with another branch and inspecting the changes noticed that GENERATE_INFOPLIST_FILE = YES was removed from our custom .framework settings, so it was missing the Info.plist. Reenabling the flag the app deployed properly.
TLDR: Our custom built .framework was missing its Info.plist.
Mine turned out to be something to do with Apple's certificates and such. I was working between two different computers and I think something went amiss. So I had to revoke my developer certificate at the Apple iOS dev site, and request a new one with a private key etc. Once the new certificate was installed, the message went
For my case, it was file missing in a newly added *.framework. One *.plist file and "_CodeSignature" folder were missing in that *.framework. Replacing corrupted *.framework file fixed my issue.
http://www.developersalley.com/blog/post/2015/11/13/How-To-Fix-App-installation-failed-Could-not-inspect-application-package-Error-When-Installing-App-In-XCode.aspx
This link saved my life, I use the XUPorter plugin, the added folder has a plist file, which is my SDK provided to me
Change the Display name in Targets > General > Identity
Build your app and switch back to your old name.
It worked for me
In my case, the reason for this error was a corrupted Info.plist file in one of the frameworks. This happened because I used bash scripts to modify a copy of the project. When I started checking the files, I noticed that some Info.plist files are not viewed in Quick look. After packaging in the framework, Info.plist is converted to binary format, but when viewed through Quick look it is displayed as text. Thus it became clear to me what happened and after replacing the corrupted files everything worked like a charm
In case someone here is consuming bazel based xcframework in your xcode project, this might solve your issue: https://stackoverflow.com/a/74027282/6709940
I had the same issue, and the problem was that I had an alias in the xCode project. I removed it and it works.
You can try following steps:
Window->Projects and look for your project and delete 'Derived Data' for all your projects with the same name

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

XCode:4.6 Lion:10.8 IOS 6.1 error: SBTarget is invalid , how to solve this?
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
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.

Resources