34

I have a small proof-of-concept app, where I am trying to embed (and sign) a framework (Alamofire) inside of my framework (AequumPOCFramework.framework), however, when I try to deploy to my device, it keeps giving me the error

....not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

If I just try to deploy my own framework, without having Alamofire embedded in it, everything works fine.

The complete error at deploy to my iphone is:

dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire Referenced from: /private/var/containers/Bundle/Application/EDB697EB-EA15-4301-B4B6-A8FE1F0212BE/PocIOS.app/Frameworks/AequumPOCFramework.framework/AequumPOCFramework Reason: no suitable image found. Did find: /private/var/containers/Bundle/Application/EDB697EB-EA15-4301-B4B6-A8FE1F0212BE/PocIOS.app/Frameworks/AequumPOCFramework.framework/Frameworks/Alamofire.framework/Alamofire: code signature in (/private/var/containers/Bundle/Application/EDB697EB-EA15-4301-B4B6-A8FE1F0212BE/PocIOS.app/Frameworks/AequumPOCFramework.framework/Frameworks/Alamofire.framework/Alamofire) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

What am I doing wrong?

enter image description here

enter image description here

enter image description here

enter image description here

9
  • 3
    Having the same problem here. Currently digging into this problem. Keep me posted if you already found a solution! Commented Nov 13, 2019 at 23:26
  • 2
    So glad to see that i am not the only one.... If I find out, I will let you know. Also, please let me know if you make any headway. Commented Nov 14, 2019 at 12:05
  • I can already tell you that it has to do with the signing process of the framework. So the problem is that Xcode says that the embedded framework's signing is wrong or not the same like your own framework ones. I'm currently digging deeper. Check this article for a good intro to the topic: medium.com/@tally_b/more-unfolding-on-ios-signings-b6886236d7fc Commented Nov 14, 2019 at 18:17
  • 3
    Yes, something is wrong with this signing process... For now, I am including my Alamofire framework to my own framework, sign and embed it there, AND sign and embed it in the App itself. I know this kind of sucks, but this will let me at least keep coding, and hopefully a real fix comes out sometime soon. Commented Nov 15, 2019 at 20:10
  • 1
    Thank you for a very comprehensive answer... I have decided that for now, I will just sign the "embedded/embedded" framework in the app itself, hopefully another answer will show up in the near future... Commented Nov 19, 2019 at 15:31

4 Answers 4

33

Nested frameworks are not supported on iOS (see technotes). The only legit solution at the moment is to link "embedded" frameworks directly to a hosting app.

*XCFramework is mainly an aggregation of platform specific binaries and has nothing to do with embedding frameworks unfortunately.

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

4 Comments

Any news about the issue? I'm facing the same problem: my framework A is using my framework B and I need the final app to only include framework A and not to be able to access framework B
@Silvia If you absolutely need to hide B, then I believe you can turn it into Static Library.
I had to copy the embedded framework into the frameworks directory of the client app - thank you for the answer
Thanks for Saving my day. Now, I have a clear understanding how to handle umbrella frameworks in iOS
1

You gotta embed Alamofire to your project, too.

For example, you are using Carthage and the Cartfile of your framework has Alamofire library. You gotta use the same Carfile for your main app, too. Also, you gotta perform other Carthage actions(linking library, adding run script) for the main app.

1 Comment

Yes, I found that out as well, however, it was not my goal to have all my Frameworks exposed to the end-developer. I was hoping to have everything nicely bundled inside of one framework (my framework). Thanks..
0

In case anyone looking solution for dylib for this error:

dylib not valid for use in process: mapped file has no cdhash

Check Code sign on copy in Build Phases -> Copy to $(BUILT_PRODUCTS_DIR)/$FRAMEWORKS_FOLDER_PATH

1 Comment

Was already checked, seems that above does nothing for iOS.
0

As Berec pointed out embedding frameworks in a framework is not supported. But there is an other way. You can statically link all the dependencies of your library, so in the final framework the binary will also contain the code of its dependencies.

If you are using CocoaPods and the name of the framework is aFramework you can do:

  target 'aFramework' do
    pod 'Alamofire', :linkage => :static
  end

Then you can use the created aFramework.framework in a application target that does not have the Alamofire framework, since the code will be "embedded" in the aFramework's binary.

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.