question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apple bundle for framework fails to import

See original GitHub issue

Cheers,

I’m trying to use the examples i’ve found online to generate an ObjC framework which i can later include in an ObjC project and i keep getting this error: fatal error: 'ObjcFramework/SampleObjcClass.h' file not found #import <ObjcFramework/SampleObjcClass.h>

where ObjcFramework is the framework i’m generating with a BUCK file and SampleObjcClass is one of the exported headers

this is the buck file for the main app:

apple_resource(
  name = 'BuckSampleAppResources',
  files = glob(['*.png','*.storyboard']),
  dirs = [],
)

apple_bundle(
  name = 'BuckSample',
  binary = ':BuckSampleBinary',
  extension = 'app',
  info_plist = 'Info.plist',
  deps = [':BuckSampleAppResources'],
)

apple_binary(
  name = 'BuckSampleBinary',
  preprocessor_flags = ['-fobjc-arc'],
  headers = glob([
    '*.h',
  ]),
  srcs = glob([
    '*.m',
  ]),
  deps = ['//ios/BuckSample/ObjcFramework:ObjcFramework'],
  frameworks = [
    '$SDKROOT/System/Library/Frameworks/UIKit.framework',
    '$SDKROOT/System/Library/Frameworks/Foundation.framework',
  ],
)

and this one’s for the framework:

apple_library(
  name = 'ObjcDynamicLibrary',
  srcs = glob(['ObjcFramework/*.m']),
  preprocessor_flags = ['-fobjc-arc'],
  exported_headers = ['ObjcFramework/SampleObjcClass.h'],
  visibility = ['PUBLIC'],
  info_plist = 'ObjcFramework/Info.plist',
  #preferred_linkage = 'shared',
  header_path_prefix = 'ObjcFramework',

  frameworks = [
    '$SDKROOT/System/Library/Frameworks/UIKit.framework',
    '$SDKROOT/System/Library/Frameworks/Foundation.framework',
  ],
)

apple_bundle(
  name = 'ObjcFramework',
  binary = ':ObjcDynamicLibrary#shared',
  extension = 'framework',
  info_plist = 'ObjcFramework/Info.plist',
  visibility = ['PUBLIC'],
)

To be noted that if i don’t wrap the library in a bundle and just leave it to buck to compile it as a static library, it works. however, i need to able to generate a framework for future use Also, here’s a repo for the whole example project if anyone wants to take a look over it: https://github.com/timofticiuc/BuckSample

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Conekocommented, Mar 13, 2017
0reactions
ediascommented, Jan 22, 2020

Is this issue still happening? I’m able to generate a framework (#dwarf-and-dsym,no-include-frameworks) but I’m having issues with headers not being included.

I’m guessing the issue remains?

I’m trying to generate fat frameworks to import on Xcode

Read more comments on GitHub >

github_iconTop Results From Across the Web

App Won't Compile with Embedded Third Party Framework
So, I'm getting this error when trying to run the app. "Build succeeds" but the app won't run and Xcode spits out an...
Read more >
How to fix "contains disallowed ne… | Apple Developer Forums
ERROR ITMS-90206: "Invalid Bundle. The bundle at 'yourapp.app/Frameworks/A.framework' contains disallowed file 'Frameworks'."... How can I fix those?
Read more >
What is Bundle.module? | Apple Developer Forums
I see that Apple developer use Bundle.module in Resources and localization session, but it doesn't seem to be available in Xcode 12. Is...
Read more >
Framework does not load on simulator - Apple Developer
When running in debug mode from Xcode with debug session active, the app launches in the simulator and I am able to debug....
Read more >
New Obj-C Header File cannot import Frameworks
It may be an issue of how how your headers are integrated into the project (is it a private, embedded framework), or you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found