How to add Mapkit framework in Xcode 4 [duplicate] - iphone

I can't find the good old "Add existing frameworks" option. How do I do this?
We're talking about Xcode 4 DP2 (in the context of iPhone development, as far as it matters...).

As per Apple's documentation:
In the project navigator, select
your project.
Select your target.
Select the "Build Phases" tab.
Open "Link Binaries With Libraries"
expander.
Click the + button.
Select your framework.
(optional) Drag and drop the added
framework to the "Frameworks" group.

I just added the existing framework folder manually into the project navigator. It worked for me.

Follow the below five steps to add a framework in your project.
Click on Project Navigator.
Select Targets (Black arrow in the below image).
Select Build phases ( Blue arrow in the below image).
Click on the + button (Green arrow in below image).
Select your framework from the list.
Here is the official Apple page.

Another easy way to do it so that it is referenced in the project folder you want, like "Frameworks", is to:
Select "Show the Project navigator"
Right-click on the project folder you wish to add the framework to.
Select 'Add Files to "YourProjectName"'
Browse to the framework - generally under /Developer/SDKs/MacOSXversion.sdk/System/Library/Frameworks
Select the one you want.
Select "Add"
It will appear in both the project navigator where you want it, as well as in the "Link Binary With Libraries" area of the "Build Phases" pane of your target.

The frameworks directory is as follows in my computer:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks
Not the directory
/Developer/SDKs/MacOSXversion.sdk/System/Library/Frameworks

In Project:
Select the project navigator
Click on Build Phases
Click on link binary with libraries
Click on the + button and add your Frameworks

Follow the screenshots:
You are ready to go!

In the project navigator, select your project.
Select your target.
Select the "Build Phases" tab.
expander. Click the + button.
Select your framework.
(optional) Drag and drop the added
framework to the "Frameworks" group.

Xcode 12
Just drag it into the Frameworks, Libraries, and Embedded Content of the General section of the Target:
Done!
Note that Xcode 11 and 10 have a very similar flow too.

Xcode add a framework
Starting Xcode v11 you should use
<Project settings> -> <App Target> -> Frameworks, Libraries, and Embedded Content
//or
<Project settings> -> <Framework Target> -> Frameworks and Libraries
[Xcode pre-v11. Embedded Binaries vs Linked Frameworks and Libraries]
[Xcode v11. Frameworks, Libraries, and Embedded Content plus Frameworks and Libraries with Embed vs Do Not Embed]
Also do not forget to check Library Search Paths or Framework Search Paths. I would recommend you to use drag-and-drop[About]
[Step-by-step examples here]

Related

where can I download StoreKit.framework

I am trying to implement ios phonegap In app purchasement plugin.
I need to add storekit.Framework to xcode project but cant find one.
I googled storekit.Framework but all information I found was how to use it and what storekit about
but not where is it. can anyone tell me where should I visit to download storekitFramework?
It is a standard framework available in iOS. To use it, simply
Select your project
Select your target
Select Build Phases
In Link Binaries with Libraries, click +
Search for StoreKit and Add
Import the framework in your class.
StoreKit.Framework is already included in all iOS SDK's above 3.0, so there's no need to download it.
To add it to your project, just click your Project's Name on the left-hand panel of Xcode (near the top), and then your project's name again, under the "Targets" section of the now second-to-left hand panel. Now click "Build Phases" near the top of the window, and then expand "Link Binary With Libraries".
Now just hit the "+" at the bottom-left corner, find StoreKit.Framework, and click add. That should do it!

load XML in iPhone App

I have a problem.
I have a XML and a project (XCode 4.1).
I must build my app with a XML file into this.
Now, where i put a XML file in my project?
In the XCode 3 there is a resource folder but now i haven't this.
Thanks
There should be a Supporting Files folder in your project. You might organize any extra files in this space.
You can put the XML file anywhere you like, so long as you subsequently make Xcode aware of its whereabouts. However, the most straightforward way is probably as follows:
Either:
Make a new group by going to File->New->New Group or
Use the existing Supporting Files group.
Drag the XML file into the group. Xcode will then present an add file sheet. Make sure that "Copy items into destination group's folder (if needed)" option is selected and your target is checked in the "Add to targets" list. Click "Finish".
That's it. Xcode should automatically add the file to the project and include it in your app's bundle.
Should you need to add the file "manually", you can select your project in the Project section of the Navigator pane (press Cmd-1 and select your project at the top left), select your target in the list (just to the right), select "Build Phases" from the tabs at the top and add the file to the "Copy Bundle Resources" build phase.
Just put it in Supporting files group.
I think this should help you.

Linking a static library to an iOS project in Xcode 4

I have a project (AQGridView) that compiles to a static library, but I can't seem to add it to my project.
Dragging in the project to my project creates a workspace, and if I try to link the libAQGridView.a file from the DerivedData directory it doesn't recognize it as a library. I'm not sure what I'm doing wrong.
This is the AQGridView project. Does anyone know specifically how to use it in an Xcode 4 project?
I do this as follows:
Drag in the static library project. If you have the static library project open in Xcode, close it now.
Select the main project in the project navigator (the project I'm adding the static library to) and in the editor, under the header TARGETS in the left-hand column, select my main project's target and navigate to the Build Phases tab.
Click the "+" for Target Dependencies and add the library icon target dependency from the added static library project.
Click the "+" for Link Binary with Libraries and add the library icon that is under the folder "Workspace".
It may also be necessary to enter a Header Search Path for the headers of the static library project if that is how the headers are linked in the static library project itself.
If you don't see the static library project as nested under the main project in the main project's project navigator, the most likely reason for that is that the static library's own Xcode project is still open. Quit Xcode and open up the main project that has the nested static library project in it without opening up the original static library project itself, and you should see it appearing as a nested project in your main project.
Xcode menu > View > Utilities > File Inspector
Select the static library file, and then set 'File Type' as 'Mach-O object code' in 'Identity and Type'.
Workspaces are supposed to make this easier, but I don't know that they do. The way I do it is create a workspace, add my main project, add my library project. Then go into the main project's build phases and add the library in the "Link binary with libraries" section and add the library. That should be all that is necessary, at least that's my reading, but it isn't. What I do is go into Xcode preferences, then to the Source Trees pane. Add a source tree that points to your static library's headers, then go back to the build settings for your project, then to the Header Search Paths key, and enter ${foo} there, where "foo" is whatever you called the source tree.
That's what works for me, though I don't know if that's the best or easiest way to do it.
Find your .a file in finder, and drag it into your project.
Select the 'copy items into destination group's folder (if needed)', and add your headers to your project.
Now, Xcode 4 should automatically link against that framework for you.
Here is what the library should look like in your project:
Follow Apple's documentation.
In brief:
Link your target against the library.
Add -ObjC to 'Other Linker Flags' (OTHER_LDFLAGS) under the target's build settings.
Also, I needed to add the library to the scheme of my main project since the library was not visible in the target's dependencies.
The Halle's answer works for me with one addition:
Check in Build Settings of the static library project the Private( or Public) Headers Folder Path value and copy it.
Add copied value to the client project Build Settings Header Search Path or User Header Search Path depending of the include directive you are using

Missing AVFoundation from existing frameworks list: How to play an mp3

I just downloaded XCode 3.2.5 with 4.2 ... I'm trying to play an mp3 file, but apparently the UI changed because I wasn't able to follow any of the tutorial instructions on how to add a framework. Finally I clicked on a little gear button then went to Add -> Existing Frameworks... However AVFoundation is not listed so I'm unable to use the following code:
#import <AVFoundation/AVFoundation.h>
AVAudioPlayer *player;
The post is asking for the "missing" AVFoundation framework. It is true that you cannot easily find it though "Add an existing framework" in some SDK versions, e.g. Xcode 3.2.
Here is the easy way to solve it, thanks to some other people who pointed it out in another forum.
Click on "Target"
Click on your app
Get Info
In the bottom, click on "+"
Now you should be able to see it. I did this and solved the issue.
Right click the frameworks group right Add -> Existing frameworks, a list of frameworks will appear just select AVFoundation framework & click add
In the "project navigator", open the "frameworks" folder and select one the existing frameworks (e.g. UIKit.framework)
Right click and select "Show in Finder" from the menu
From the newly opened folder in the finder, drag the framework folder you are interested in (e.g. OpenGLES.framework) into the "frameworks" folder in XCode
Be sure not to "copy items into destination's group folder"
Choosing "Create groups for any added folders" seems to make it
(duplicate from previous question-- just dumped it into this question as well for any one still struggling with it)

How do I rename a project in Xcode?

i have a finished application written with objective c and I would like to rename the file. how do i do that?
Recent versions of Xcode have a "Rename..." item in the Project menu.
Renaming a project has changed in Xcode 4+. (Kris Markel's answer above is for Xcode 3.2.x )
Follow these steps to rename your application in Xcode 4.0 or later:
In Xcode, select your target under "Targets" in the project editor, then choose View > Utilities > Show File Inspector.
Xcode opens the file inspector pane. Enter your application's new name in the Project Name field as shown in Figure 1, then hit the return key on your keyboard.
Xcode displays a project-rename dialog that contains all the items that can be renamed in your project. Leave your application selected in the dialog and deselect all other items as shown in Figure 2, then click Rename to perform the rename operation.
Source: iOS Developer Library Technical Q&A QA1625