3

We have two different apps : one for iPhone, and one for iPad, which are not linked using workspace. So, think of them as being in two different unlinked folders.

Now, I have created an iOS framework (Cocoa Touch Framework) which I want to include it in both iPhone and iPad. So, as per tutorials I encountered, I created a reference to the Xcode-Project file of framework in the iOS App project, but when I follow the next step i.e. to "Add Target Dependencies", this framework is not shown.

I don't know how to proceed. I want to include the framework to both without creating further copies of Framework.

Thanks in Advance.

2
  • You can go through the video youtube.com/watch?v=HmfEuhb8Lls this may help you . Commented Feb 2, 2016 at 9:02
  • This is the normal way that I am aware. I was thinking to avoid this as I had to always find the .framework folder and then add it to the project whenever anything is changed in the .framework folder Commented Feb 2, 2016 at 12:26

5 Answers 5

2

Target>Project>Build Phase>Link Binary with Libraries>Add items(+)>Add Others>Path to external framework.

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

I can definitely add it like this. But since, I am going to make changes in the framework, I will need to keep on adding it again and again whenever it's changed. This needs a lot of managing on our end.
I am not using Workspaces
2

I add more information. Make sure that:

1 Target>Project>Build Phase>Link Binary with Libraries>Add items(+)>Add Others>Path to external framework.

2 Build settings > Framework Search Paths > add the framework parent path

Based on the two setting , you can link the external framework outside project.

1 Comment

Xcode is so awful. I click and drag the framework from group of "Products" from the library workspace to the "Frameworks, Libraries, and Embedded Content" of my test project, and it appears to work: it adds the framework to the group of "Frameworks". I click on that, it accurately shows the full path of the framework. The build fails because the framework search path isn't set. Xcode "knows" where it is, but it can't "find it". Thanks
1

Add the custom framework in the Embedded Binaries as following picture. Because it is not a system framework, it needs to be copied into the application bundle.

About embedded binaries:

The image

8 Comments

You mean "copied into the app bundle" not "copied into the project", right?
Doing this means, whenever you are making changes in the framework, you need to add it again. This way needs more managing. I was looking to add it as a subproject framework but with external folder.
@ShubhamAggarwal No, you don't need to add it again after any changes. It means the application bundle needs binary of that custom framework. If it is a system framework, the binary of framework can be found in the mobile device, but if it is a custom framework, it is impossible to find the binary of framework. So, the binary of framework needs to be included in the application bundle.
@ShubhamAggarwal If you add the custom framework which located in the path '/User/xxx/A', after you change your custom framework, you need to sync the built framework to '/User/xxx/A'. You can write some scripts to do such things automatically.
@Toro: That do seems a solution. But it won't work great in case of a team. Because the path of framework generated is dynamic. Take the case, if i delete derived data. But this thing may work if that script finds that dynamic path automatically. I don't know if the "Run Scripts" option in Xcode will help.
|
0

Adding to @AechoLiu's answer, with Xcode 11.1, I had to set the Framework's Embed column to Embed & Sign, otherwise the Framework won't be bundled.

Comments

0
  1. Add external framework

  2. Build Settings > Framework Search Paths

  3. Find the related path and update it with "recursive"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.