4

I have a Cocoa Touch framework created in Obj-C, I have built it for simulator as well as for arm7, 7s, 64 and it is a fat framework.
After adding this framework to the test project by dragging, when I try to add header file through import it autocompletes, yet Xcode is unable to locate those files and returns an error.

I have tried adding search paths as well but to no avail, Xcode just doesn't find those files.

I have made all those headers public while creating framework, have tested with an embedded test app it works

Here are Xcode images

vishal dharankar
  • 7,536
  • 7
  • 57
  • 93

7 Answers7

5

You need to specify the header files you want 'public' when making your framework.

In Xcode:

  1. Select the header file you want to expose (project navigator)
  2. Select 'file inspector' right hand side in Xcode.
  3. Locate the section 'Target Membersip'
  4. Make sure that your framework is selected
  5. After the name of your framework there is a selectable drop down meny.
  6. select 'public' out of public/private/project.

re-compile the framework and re include it. Now you see the header file you made public.

Anders Cedronius
  • 2,036
  • 1
  • 23
  • 29
2

I think you need to set "Header search path" in Build Settings

Smit Shah
  • 209
  • 2
  • 9
  • Yep tried that already , what I wonder is Xcode is able to autocomplete but compiler unable to find it , adding to header search path doesn't work either – vishal dharankar Dec 24 '15 at 11:54
1

No problem in finding header but I get another error about missing architecture

AdGateMediaiOSSDK.framework/AdGateMediaiOSSDK, missing required architecture x86_64 in file

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_AdGateMedia", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

After connecting an iPhone and disabling the bitcode, project compile and built.

Anand
  • 864
  • 10
  • 31
  • no, on simulator it does not work because the architecture x86_64 is missing when you built the framework. – Anand Dec 29 '15 at 16:17
  • Yes i guess so , i think i forgot to aggregate the simulator build – vishal dharankar Dec 29 '15 at 16:18
  • 1
    So all I did is that i created a new project, downloaded and unachieved your framework and dragged and dropped the framework file with copy option selected for the main app target and then imported the header as shown in the screenshot. You can try enabling architecture for simulator and if you want also enable the bitcode. – Anand Dec 29 '15 at 16:20
  • I was able to get rid of those errors too, but then saw theses simulator build errors, thanks anyways – vishal dharankar Dec 29 '15 at 16:21
  • I am still not sure which step cured the issue , i will create a new test app and check again – vishal dharankar Dec 29 '15 at 16:22
  • But now library doesn't load , error it gives is dyld: Library not loaded: @rpath/AdGateMediaiOSSDK.framework/AdGateMediaiOSSDK Referenced from: /var/mobile/Containers/Bundle/Application/E8F169C5-0F32-4966-97AF-D51604FE4C13/SDkTestIos1.app/SDkTestIos1 Reason: image not found" it seems it wasn't able to find binary for the framework – vishal dharankar Dec 29 '15 at 16:24
  • Did you try this http://stackoverflow.com/questions/20092886/image-not-found-error-while-using-custom-framework – Anand Dec 29 '15 at 16:28
  • 1
    Thanks , found out that the framework wasn't added to "Embedded binaries" section now its working – vishal dharankar Dec 29 '15 at 16:30
  • Thanks for taking detailed look into the issue – vishal dharankar Dec 29 '15 at 16:37
1

SOLVED!

Do what Anders Cedronius told ☝, and then, if the problem persist:

  1. Right click on [YOURIMPORTED.framework -> Show in Finder] (and the finder window will apear)
  2. Close Xcode (Command + Q)
  3. On the Finder window: Delete the imported YOURIMPORTED.framework
  4. On the Finder window: Paste the RECOMPILED.framework
  5. Open your project on Xcode, and Build/Run it!

Done :D

0

When you drag the framework to your project,do remember you have selected the option "copy items if needed"

0

I used to get this issue when I was using the library provided by a third party.And you should have noticed that the related .framework file was marked with a question mark, which might not be recognized by the XCode and appeared to be the same issue as I met.

My solution was right clicked the .framework file and deleted it, and then added the original file again until the question mark was disappeared.

Good luck.

-1

It would be like this:

#import "AdGateMediaiOSSDK.framework/AdGateMediaiOSSDK"

Hope this help.

Nghia Luong
  • 790
  • 1
  • 6
  • 11