3

I am using Xcode 4.3.

  • I have an existing Xcode Project (originally created in Xcode 3) for a embeddable Mac OS X Framework. This Project has a few Targets, but the primary Target in this project is for my Framework. This Framework is designed to be embedded in Mac Apps and has the appropriate Installation Directory properties set. (@executable_path/../Frameworks)

  • I have a new Xcode Project (created just now in Xcode 4) for a Mac OS X Application. There is only a single Mac App Target in this Project.

I would like to combine my old Framework Project and/or Target into the new App Project so that I can build both the App and Framework from source in a single, combined build process. (I have done this in Xcode 3 many times, but cannot figure it out in Xcode 4).

I do not (unless it's the only way) want to build my Framework separately and then just link to it from my App Project. I want to combine the Framework Target into my Mac App Project.

Here's Apple's outdated documentation describing how to do what I want in Xcode 3:

Embedding a Private Framework in Your Application Bundle > Using Separate Xcode Projects For Each Target

How do you do this in Xcode 4?

Note: I just need to know how to add my Framework Target to the new Project. From there, I know how to add the dependencies and do all the Build Phases of linking and copying the built Framework into the app bundle.

Todd Ditchendorf
  • 11,217
  • 14
  • 69
  • 123

2 Answers2

3

After working through a tricky issue in Xcode 4.3.1, I discovered how to do this. I've given a full/detailed example in my answer to another question about how to embed ParseKit in a Mac App.

I also found excellent information on the topic in Chapter 16 of Mastering Xcode 4 by Joshua Nozzi.

Community
  • 1
  • 1
Todd Ditchendorf
  • 11,217
  • 14
  • 69
  • 123
  • Todd, I am hoping that with your level of knowledge about Frameworks within Frameworks, you may be able to help me decide the best way to do it. I have a question here: http://stackoverflow.com/q/25191681/1735836 The question explains better what I am trying to do. Please have a look. Thank you. – Patricia Aug 08 '14 at 21:10
2

You actually have 2 separate Xcode project files here: Application and Framework. The answer is the section below the one you find: Using Separate Xcode Projects For Each Target

Edit:

OK. Now I remember. You need to create a workspace and add both projects to it. Then you can add target in one project to the other for dependency: Adding an Existing Project to a Workspace

I don't have all the details since I don't have a Mac now. But I think you can figure it out once you created the workspace.

Stephen Chu
  • 12,724
  • 1
  • 35
  • 46
  • You're right that I have 2 Xcode projects, and that I was pointing to the wrong place in the docs (I've fixed my question). However, the docs you are linking to are also out of date. They show how to do this in Xcode 3. I am specifically trying to learn how to do this in Xcode 4. – Todd Ditchendorf Mar 11 '12 at 03:44
  • Do you mean you cannot add the framework .xcodeproj file to your application project? I don't have my Mac now but I was able to do it in Xcode 4. I will check when I am in the office on Monday. – Stephen Chu Mar 11 '12 at 18:01
  • 2
    Ah, I discovered a bug in Xcode 4 which was preventing me from adding Projects to a Workspace. That was causing my confusion. See here: http://stackoverflow.com/questions/9657691/xcode4-dragging-a-project-to-a-workspace-shows-tiny-xcodeproj-file-in-project – Todd Ditchendorf Mar 11 '12 at 18:49
  • Glad you find out what the issue is. I wouldn't call it a bug but Xcode should prompt user for the open project. – Stephen Chu Mar 11 '12 at 19:13