Xcode 4: multiple workspaces open with same project? - xcode

In reference to Problems adding Projects to Workspace in Xcode 4, has anyone found a way of including the same project in several workspaces and having them open in Xcode 4 simultaneously?
For example, I have a project which builds a static library. I want to include that project in a workspace with a Mac app project, and in a workspace with an iOS app project.

It's a known limitation of the current Xcode 4 that it cannot reference the same project several times simultaneously in different workspaces. This has been reported, and Apple knows about it. However, it is not clear whether this is going to be fixed. The only way to increase the likelihood of Apple fixing it is for you to file a bug report.
One way to work around the limitation is to work as if Xcode couldn't open more than one workspace at a time. So for each of your workflow scenario, you simply create one workspace that contains all the projects you might be lead to work on in this scenario.
This leads to unnecessary workspace multiplication, but after all, this is not a big deal.
More critically, that's yet another case where Xcode 4 works hard to prevent the user from adopting a multi-window work style. I encourage you to file a bug report for this too, as feedback from WWDC indicates that Apple didn't find complaints about that loud enough to fix it.

Related

Need to always reload project in Xcode for it to function

I've built a couple dozen projects in Xcode and only one of them experiences this strange issue.
Every time I load Xcode to resume work on the project, Xcode auto-loads the project (good) but in an unusable state (bad). It appears this way:
The project name is grayed out, with no disclosure triangle. I cannot access any of its contents, and trying to build it fails immediately with no error message other than "Build Word Practice: Failed" as you see in the screenshot.
But if I close the project and reload it, it functions fine. The only oddity about when it loads this way is that it appears with all its disclosure triangles closed, and I have to manually "disclose" the contents of all the folders in the list each time:
I have had this issue with all recent versions of Xcode, up to and including the current version, 11.5.
The project does not use any features that are not present in other similar projects I've written that behave fine. So it would seem to be a matter of corruption… but besides deleting derived data and doing a clean build (which I've done), I can't think of any other steps to take.
I would include code here, but short of including the whole project (and I doubt that would help), I wouldn't know what to include.
Any ideas?

Xcode 5 and shared Schemes

I'm having an annoying issue with Xcode 5 and the shared schemes.
In my team (we're just two, but hey! it's still a team) we're sharing some Schemes to run the app with different configurations (Debug, QA, Release, ...)
Well now Xcode 5 seems to change the BlueprintIdentifier setting of each scheme based, from what I can understand, on the machine of the developer. And of course the change get's noticed bit git and we either have to checkout them, or commit. Both solution don't make sense...
Any idea on how to fix it? I did a google search but found nothing for Xcode 5...
I don't want to give up on those shared configurations! A solution I can came up with to keep having the shared Schemes tracked is unshared them, copy them in a dedicated test folder, then using a strategy like the one used for the Pods to copy those schemes locally, where Xcode can mess up with them without us noticing. Something like a schemes script that reads a Schemefile file which lists the schemes to copy from the Schemes/ folder, and a Schemefile.lock that is updated every time there's some change and that is read by the Xcode build process in order to make sure everything is up-to-date.
This seems a lot of work for such a tiny thing, so before jumping head down into it I would like to know if anyone has some better solution to propose.
Cheers :)
First, I'm assuming you're using CocoaPods because you mentioned it in your question.
I've had this issue for a while and just recently discovered that some of my shared schemes are not getting their BlueprintIdentifier changed with the others. Upon investigation, I noticed that the untouched schemes had a Pods target under builds that was missing–as in it was listed in red like this: Pods (missing). My theory is that pod install and various Xcode events (i.e. crashing, launching, etc) were causing the scheme to change its BlueprintIdentifiers because they had a reference to a Pod target in the scheme build settings.
I removed the Pods reference in all of my schemes and have not been able to reproduce the BlueprintIdentifierchange since. My target that depends on Pods has libPods.a specified under Link Binary With Libraries in Build Phases and set to required, so it still gets compiled before the main target.
Note that switching between branches with this change and without this change might still produce modifications to the scheme files.
#Wes's answer didn't specifically fix this issue for me, but it did lead me to the right place. The solution for me was to turn "Find Implicit Dependencies" from "off" (unchecked) to "on" (checked) from the Edit Scheme screen for the Scheme that keeps changing.

Why is Xcode's Search Navigator searching the wrong project's files?

I have a large Xcode project for a game I'm building. I recently switched versions of the animation framework I'm using (cocos2d), and to keep things clean, I went ahead and created a brand new Xcode project from scratch.
Afer creating the new project file, I made copies of all my source files in the filesystem, then symlinked them into the new project by dragging them into the Xcode Project Navigator. Everything worked fine.
But here's where it gets weird. Whenever I use the Xcode Search Navigator to do global text searches on my project, it searches files from the old project! And only files from the old project!
The only conceivable explanation I can come up with is that Xcode is somehow recognizing my filenames as being the same as were used in the old project, and has decided to ignore the newer versions in favor of the old ones. Is there any such cache or preference within Xcode that can do such a thing? Keep in mind the paths are different, since the new project's files all exist in a brand new directory. But the class names are the same.
In case this is relevant: I once created an Xcode Workspace that included the old version of this project (but not the new one.) I abandoned the workspace long ago as it was problematic, in favor of working with the project directly.
UPDATE: This appears to be an Xcode-related problem-- I have discovered I have the same lack of search-ability in all of my projects. I uninstalled Xcode (I had the version that was still using the Developer directory) and installed the latest version (4.3.3) that does not use the developer directory, but I am still seeing this problem.
I am curious if anyone knows a way to wipe out Xcode's cache of project code indexes, if such a thing exists, that might potentially "reset" its knowledge of my projects and thus fix the situation. Possibly something in the Library directory?
One last clue as to what might be happening: In addition to the search navigator failures, I noticed one of my projects was still using resources that no longer existed in the filesystem-- again, making me think Xcode has cached information about my projects somewhere and is now using outdated versions of my files that no longer exist. this post helped me solve that problem by resetting the simulator's content and settings, but the search issue persists.
Have you checked your Find Options? This same problem was biting me and then I remembered I had added a custom Scope in 'My Scope' that directed XCode to my other project. Changing this back to 'Workspace' fixed the problem.

Corrupt VB.Net VS2010 project recovery

In the last year I've worked on two relatively large .NET projects and both of them have ended up with project/code generation strangeness that I just haven't figured out how to fix..
The first project generates some bad code for forms that causes the VB.Net build to fail. I actually had to make a search/replace macro that fixes the 5 problems by adding a Global. to the beginning of a few references.
I chalked that up to a random act of unkindness against me and went on my way since the macro takes about 2 seconds to run...
So now 6 months later and new project is cranking along and I get a similar-ish problem. I have a bunch of form controls that store state in a settings file using the built in capabilities of .Net. I had about 20 controls that were configured automatically this way. Works great until today when for reasons I don't understand in the designer.vb file gets corrupted. At least one other person on the planet has had this problem here:
http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/9bd20b56-7264-4a1f-a379-ad66b372ddd3
but the proposed solution didn't change the behavior.
So now I've had two projects (larger ones) that have project file issues that I can't resolve (I've had several smaller projects that are just fine).
What tools are available to fix projects, migrate projects, lint projects ... anything to recover projects to a reasonable state? Any successful recovery procedures beyond a roll-back/merge?
i had a corrupted reference issue linked to my use of mercurial and VS getting lost in file save time... if this may help...
If you open it in notepad and its corrupted - then its probably corrupted and the only way to restore it would be to go to a backup.
--> go to backup
-->click your project name
-->and then find your fire thats are corrupt

svn conflict xcode project file while working in team

I'm working in a team that's developing iPhone application (about 7 people). We use SVN for source code control of iPhone code, we keep running into conflict issues with xcode project file and iPhone nib file. I think there has been a question asked about this problem : How to merge conflicts (file project.pbxproj) in Xcode use svn?. I want to ask if anyone has ever come up with a satisfactory solution to this. Since our team is fairly decent in size (7 people), manually resolving conflict in xcode project file everytime someone changes code, or adding new object into nib file is a huge productivity waste. Has Apple engineers ever thought about this issues when they wrote their own iPhone apps ? I have been looking for a satisfactory solution using Google and Bing, not yet found one.
Thanks,
This is definitely a HUGE flaw with xcode. I'm on a team of similar size and here's what I do to make the process as painless as possible:
SVN update (ALWAYS do this before a checkin as well):
quit Xcode. The quickest way to do this is to use Alfred and type "forcequit xcode"
"svn up" in the project folder from command line
If you have any merge conflicts with the project file, hit "edit" to open in emacs or whatever
search for "======" to find merge conflicts; delete that line as well as the "<<<< mine" and ">>>>" lines
save & exit. hit "r" to mark project as resolved.
re-open project - "open MyProject.xcodeproj/"
With a bit of practice you can get this process down to under a minute (I do this several times a day).
for NIB files, DO NOT work on while someone else is working on it. There's no real way to merge them. Make your changes quickly and check in right away (there aren't many cases where 2 people need to work on a NIB file at the same time anyway). For less complicated views, just lay them out programmatically.
Try installing SourceGear DiffMerge. This is a merge tool that should make it a lot easier to merge the changes. Also see this blog post about configure XCode to use DiffMerge

Resources