How to import a JUCE static library on an iOS project?

Thanks to the Projucer, I created this very basic project, just to understand how to generate a static library for iOS and how to import it on an iOS project (it’s a screenshot made with Android Studio, but I actually built it with Xcode 13.2.1):

I managed to generate the library and locate the .a file. By running lipo -info libJuceDemo.a, I can see that it’s a fat file, targeting the arm64 and the armv7 architectures (that being said, I got sometimes that it’s a non fat file, only targeting arm64, I still don’t understand why…).

Now I’m trying to import it on an iOS project, and here is what I did:

  • I created a CPP group, then a Juce group, and copied the libJuceDemo.a, AppConfig.h, JuceHeader.h and JuceTest.h files in it, as you can see here:
    image

  • If I go to Runner > Targets > General > Frameworks, Libraries, and Embedded Content, I can see that libJuceDemo.a is here, as expected

  • Then I went to Runner > Project > Build Settings > Search Paths, and for Header Search Paths, I added: $SRCROOT/Runner/CPP/Juce (I tried both recursive and non recursive)

Then I tried to call the code of the library from my C++ code of my iOS app:

  • I added: #include "Juce/JuceTest.h"
  • I instantiate the JuceTest class as the following: jucetest::JuceTest juceTest;

Now when I try to compile and run my iOS app, I get the following error:

error: unknown type name 'JuceTest'

One more thing: If I go to Runner > Targets > Build Phases > Dependencies and click the + button, I can’t find neither my library nor any of its header file…

Did I miss something?

Thanks for your help.

My bad, it was actually an error in another class, it’s working now!

Now I’m stuck with a new problem: as soon as I use a JUCE class in my JuceTest class, I get the following error when compiling the parent project:

JuceHeader.h:17:10: fatal error: 'juce_audio_basics/juce_audio_basics.h' file not found
#include <juce_audio_basics/juce_audio_basics.h>

Does it mean that I need to copy in the parent project all the JUCE framework header files?
It seems very odd and it will take forever!

Is there a simple way to make it work?

Thanks.

I created a new post here.