37

After updating with Xcode 6.3, I found something strange things with my projects.

Below codes causes parse issue that says "Could not build module 'AgendaFramework'", the AgendaFramework is my custom embedded framework for ios8:

@import MyEmbededFramework;

The error marker looks like this:

error

The issues is raised during indexing not building. Whole building can be performed successfully without any error or warning. I can build, archive, run on device, deploy, submit to App Store.

However the error marker shows up when I edit the classes that belongs to the extension. The the extension(widget) explicitly linked to the embedded framework. (I know that I don't have to do it when I use @import statement.)

In this state, I could not receive any valid content assistant, very annoying.

After I replace the import statement with old style, the problem was disappeared:

#import <AgendaFramework/AgendaFramework.h>

I have several other projects that have very similar topology with the project which causes this issue, But they are okay. Only one project causes this issue. I compared every detail build settings, I could not find any clue.

I tried:

  • Delete derived data
  • Full Clean
  • Reboot

Any clues are welcomed. Thanks!

jeeeyul
  • 3,727
  • 1
  • 24
  • 37
  • Have you really created a iOS8 dynamic framework??? – Fab1n Apr 14 '15 at 14:14
  • Yes I did and it worked well with Xcode 6.2. – jeeeyul Apr 14 '15 at 14:15
  • 1
    And it is still work with build. The problem is only occurred when live indexing. – jeeeyul Apr 14 '15 at 14:16
  • 3
    Clean build folder (CMD+Option+Shift+K) and delete derived data folder, restart Xcode, restart Mac – Fab1n Apr 14 '15 at 14:17
  • problem seems to persist in 6.4 :( – Mihai Timar Jul 01 '15 at 17:54
  • 2
    I too am having the same issue. The #import works, while @import Framework; says cannot build module. The funny thing is that the project does build and runs successfully; the error message always comes up post-build. – rvijay007 Aug 13 '15 at 08:37
  • 2
    I had my framework in a subfolder from the main .xcodeproj file. I previously used that subfolder for all 3rd party frameworks and had added that search path recursively in the settings so I didn't have to mess with a lot of extra search paths for every framework I add. Somehow that didn't work with @import, so I just added the framework to the same folder as the .xcodeproj file, no subfolders or anything. Then things started working - no problems. – Jonny Feb 18 '16 at 02:07
  • your can try this, it's work for me.[Delete DerivedData files](http://stackoverflow.com/a/44038363/1528524) – lingyfh May 18 '17 at 04:07

8 Answers8

32

It looks like turning on: Allow Non-modular Includes In Framework Modules solved this issue for me.

kwz
  • 701
  • 6
  • 13
  • 3
    in specific case, this approach also now work, sometimes work. – jeeeyul Oct 13 '15 at 06:12
  • Allow Non-modular Includes=YES, how to make it , I have same problem, please support me – vualoaithu Oct 05 '17 at 05:00
  • 1
    jeez, that rates as double obscure in Xcode settings... Fishing around that is Click on Target > Build Settings > All > Combined > Allow Non-modular Includes In Framework Modules. Xcode is a miserable POS. (piece of software?) And to top it off, nope, it didn't work. – Cerniuk Dec 24 '17 at 04:34
4

Hi this is due to the fact that file which you are making it public in framework header must be public also.

Change from "project" to "public"

vivek
  • 459
  • 3
  • 14
3

Sometimes this issue can be solved by adding the framework to the same folder as the .xcodeproj file, no subfolders or anything.

Credits to Jonny who points it out as a comment in the question.

inigo333
  • 3,088
  • 1
  • 36
  • 41
  • 1
    Thats an ugly way but it worked for me. Couldn't find a better way. Please update this thread if you get one. – user550088 May 31 '18 at 20:38
1

Solution that worked for me: diligence in framework header file orientation to system style imports... like #import <CoreXLib/CoreThreads.h> the story:

In my case my framework that I built came from the combination of several code bases as it became apparent that I could reuse some of the general design patterns across that code easer via Framework vs the fragile Xcode project pathnames.

As I built my framework "CoreXLib", I reorganized it into the Cocoa Framework typical of Xcode. I changed my imports from:

    #import "CoreTypeAliases.h"    // project local style   

to

    #import <CoreXLib/CoreTypeAliases.h>    // system or framework style

appropriately. Several projects that used the CoreXLib.framework which includes the public headers in the lego-folder worked... so I thought I was good to go...

Unfortunately some of the headers that were public did not get fully updated. The classes in the framework built just fine in the local style. All projects using it worked up to this point and then I ran into one that didn't... and the error noted by @jeeeyul

So after finding this thread and finding @kwz 's solution, and not having it do anything in my case, I decided to polish the code up while I was trying to figure this problem out. In the polishing, I found that some of the #imports did not get changed like they should have in the Xcode search and replaces. Time for some hand-jamming...

After fixing all of those references in all of my CoreXLib project headers (not just the public ones, self defense), I dove back into the problem... I took the newly complied CoreXLib.framework over to the errant project that embedded it... and the problem had vanished! I checked the Allow Non-modular Includes... in both the framework project and the project that linked the framework in and both were "No". Flipping both to "Yes" and to "No" made no difference in several tests. The only other change was the #import "..." to #import <CoreXLib/...> modifications.

So sometimes polishing the apple knocks the bugsoff...

Cerniuk
  • 14,220
  • 2
  • 29
  • 27
1

set YES in Build Active Architecture Only in build settings. It worked for me.

enter image description here

0

Today I solved this problem by those steps,:

  1. Chose the schema "MyEmbededFramework"
  2. Press [Command + B] to build
  3. From the build phase panel, add "MyEmbededFramework.framework" to Link Binary With Libraries

Try to build your project, the problem may disappear now.

0

you can try this, it's work for me. delete DerivedData dir that about your project.step by step

Community
  • 1
  • 1
lingyfh
  • 1,363
  • 18
  • 23
-11

Turn off module's in build settings. That may work

user2918201
  • 52
  • 1
  • 7