Xcode automatically renames libraries inside the library - ios

I have an issue and I guess somebody can help me to resolve it.
So, I created my own framework from my code and I added dependent frameworks in it. That's OK.
There is the struct of it:
After that I've implemented my own framework into my app. I can launch app without any issues on my real device. There are no any issues with it. My framework works as expected.
I need publish my app with implementation of my own framework. And I see that for some reason the frameworks inside my framework have the same name:
Although it should be 7 frameworks with names as in the structure. As result I see the error from Apple:
The question is: why did my internal frameworks get the same name when trying to publish and how to fix it?

Please check under your "Build Settings" option, there is "Build Options", check if below setting is switched to "Yes".

Related

Xcode - Archive product goes to Other Items instead of iOS Apps

I am using XCode 11.2.1 and out of nowhere the archives for deployment appear in the Other Items category, instead of iOS Apps (in Organizer). I am using my custom static framework and what I found that this may be the issue, but for a while, like a month or so after I created and used my framework, I had no problems with deploy (I am also using CocoaPods, but that was ok).
I have tried a lot of things like here:
Xcode 10 Archives to 'Other Items' instead of 'MacOS Apps'
and it worked for a few times, but now, with multiple cleanings, deleting derived data, etc, nothing works.
Here there is a reference to header files (but I have never changed anything about them when it worked): https://developer.apple.com/library/archive/technotes/tn2215/_index.html#//apple_ref/doc/uid/DTS40011221-CH1-PROJ
The problem is that the help link about Copy files is not working and also (I cannot find "Copy files" section in Build phases - maybe it was renamed), the Xcode version is different (I found other posts on StackOverflow) so I cannot manage to make them work (I am pretty new to Xcode and C++ / Obj C / Swift and it is difficult to manage those options if I cannot really understand the references (or with missing help/explanations, which I don't know where to look for)
I used this to create and use my framework: https://www.raywenderlich.com/5109-creating-a-framework-for-ios (and different other links but very similar to this one)
Can someone please provide some help regarding the steps needed to make your app deployable to AppStore while using my custom framework? I can provide other information and screenshots if needed. Thank you.
EDIT:
Is there a way to check what is different between the creation of the last archive that worked and the new one that I cannot deploy?
After archiving my app I also exported it and explored it in Finder (as instructed here: stackoverflow.com/a/15120289/1215791) So there is no libraries folder. It seems that the problem is not related to forgetting set Skip Install to YES for something.
Check the contents of the .xcarchive, this happens when there's more than one item in Products/Applications. It should contain only your application.
After finding the extra items there, you can then know for which target you should set "Skip Install" to Yes.
This just started happening with Xcode 13.3.
Turns out that I was adding the DocC to the Products/Applications directory. I turned off the flag for compiling documentation ("Build Documentation during 'Build'"), and it started working again.

Framework folder getting generated inside dynamic framework

I am creating a dynamic framework using Swift. When I build the framework, the resulting artifact has a Framework folder that has a bunch of system dylibs that I don't expect.
I am using this documentation for reference - https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html#//apple_ref/doc/uid/20002253-99920-BAJFEJFI
Because of this folder and libswiftRemoteMirror.dylib, the app's release archive is getting rejected by iTunes upload.
I found out the solution to this. In my framework build settings, I had Always Embed Swift Standard Libraries enabled which should have been disabled. Not sure why it was enabled in the first place, since I didn't write the framework, someone else did. But I think it might have been because they started the project using an iOS app template instead of the framework template.

Adding a custom Framework to an Xcode project

I decided to try to make a Cocoa Touch Framework. Making it worked fine, but I am having trouble adding it to a project. After searching through a lot of SO posts and looking at Apple Forum threads I decided to try this from the Docs:
Add a framework bundle to a project in order to incorporate the
framework’s features into your product.
In the project navigator, select the project or group within a project
to which you want to add the framework.
Choose File > Add Files to “”.
Select the framework bundle, and click Add.
The frameworks you add this way are third-party-built bundles
containing the framework’s object code and runtime resources. See
related articles for information about linking to a framework without
adding it to the project.
After you add the framework, Xcode configures the targets in your
project to link them to the framework just added.
It still doesn't work. I am getting a No such module 'Scaffold' error for everything I try, I have checked spelling, but that is not it. Can someone explain how this works? I might just need clarification on how this is done.
Links I have looked at:
Create and import swift framework
Xcode error when I add a framework
Adding a framework to XCode 4
Xcode 5.1 compiler errors after adding a framework
Add a framework to an existing project without using cocoapods
What is the process for creating a Framework?
Hey I do not know if it is too late to answer this question, but due to the fact that I am facing same issues right know I would recommend you to check the Build Settings of the project where you import your framework
You should check the "Framework Search Path" and if the framework is at Swift and you import to an obj c project check YES to "Always embed swift standard libraries"
More or less the problem I think is in the Build Settings

How to build iOS framework with XCode 6

I know of familiar tutorials on this, but introduction of framework XCode 6 template has changed the game.
I already watched WWDC 2014 video about building modern frameworks but it talks more about building extensions, framework & app all inside single project. It does not specify if the framework I make with it is truly reusable across any project.
I am building framework the XCode 6 way (File->New Project->Framework and Library->Cocoa Touch Framework), but when I import it inside my test app project (separate from framework project) - I keep getting various errors.
Example: Include of non-modular header inside framework, and so on.
I know this is not what it says, and there are quite some missing steps in whatever I am doing. The older tricks may have worked for everyone, but I simply don't find which way to follow after XCode 6.
For example, there is some folder structure that a framework needs, but XCode 6 doesn't comply to it while building it. Is it right? If not, how can I change the way the XCode builds framework folder hierarchy?
Do I go back to old school or am I screwing some tiny thing in XCode 6 that I am unable to create a reusable framework?
I am not sure if you are trying to build a framework with Objective-C or Swift as your question doesn't state it. I've encountered errors you are mentioning with Swift so I'll give you my method to build Swift frameworks.
I found the process for Objective-C to be very straightforward and well documented, so I'll skip this.
As for Swift, there are a few things to consider. First, Swift static libraries are not supported, so you must exclusively use a framework (aka dynamic library) when linking an app to a library.
Here are the steps:
Create the Framework using New > Project under IOS > Framework & Library, select Cocoa Touch Framework
To avoid the "ld: warning: directory not found for option..." goto Library Search Paths in Build Settings for your target and delete the paths.
You can't mix Objective-C with Swift so don't even consider adding the Swift-Header bridge file in your code.
There are some cases in swift where you need to import code from unexposed Frameworks. I've successfully used the module-map inside the framework to deal with these case.
I also select CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES in the Build Settings to solve 'include of non-modular header inside framework module'. That seems to work
I make sure that the header file that gets generated is marked as Public (not Project). Click on the file and you'll see the selection in the inspector under 'Target Membership'
You may run into some bizarre error messages when building. Xcode has a tendency to report linker errors when your code can't compile correctly resulting in missing files the linker needs to output its binaries. Sometimes XCode won't show the errors in the files you are compiling and you need to go manually on the build output and go back to the files. Some other time, you'll get a problem where you need to delete the cache. Those issues I call XCode blues and deal with it constantly. I found this type of problems happens more often when building libraries. The rest should work as expected.

Validation Error: The bundle contains disallowed nested bundles

As a followup to my other question, I'm continuing to have issues submitting my iOS 8 app (which includes a Sharing Extension and a framework target). On a submission attempt I receive the above error message. Others with my issue (as pointed out in the afore-linked question) have the same issue, but resolved it in ways that aren't relevant to my case.
The error message implicates my Sharing Extension target, which links to a framework that I wrote, which is shared between the Extension and the app. I'm pretty sure Apple was clear that I'm allowed to use frameworks in Extension targets (in fact, it's preferred!). So what other causes might there be for this error?
Well, the answer seems simple enough: in the Extension target I was embedding the framework (Build Phases > Embed Framework). Once I removed that setting, everything works fine.
Sigh.
I had to remove
(Build Phases > Embed Pods Frameworks)
From the today excitation.
Was able to upload to appstore but this bring other problem the today excitation is not working
dyld: Library not loaded: #rpath/AFNetworking.framework/AFNetworking
For me, Aaron's answer was only half the answer.
After removing my framework from my extension's Embedded Binaries, I had to add it to my extension's Linked Frameworks and Libraries.
(Both can be found in the extension's General tab.)

Resources