Adding Juce to existing iOS project


#1

Hi, does anyone knows how to add Juce to existing iOS project,

When i add juce modules to my project i'm getting this errors

 

JuceLibraryCode/juce_core/native/juce_osx_ObjCHelpers.h:153:9: Call to unavailable function 'object_getInstanceVariable': not available in automatic reference counting mode

JuceLibraryCode/juce_core/native/juce_osx_ObjCHelpers.h:146:16: No matching function for call to 'objc_msgSendSuper'

Does anyone knows whats going on ? When i turn off ARC first error goes away, but second is still there.


#2

Those are low-level obj-C library functions.. I've no idea which actual system library they come from, but you might be able to google for them to find out more and make sure you include the right headers.


#3

I've managed to fix it.

But now i cant find any tutorial how to use Juce audio modules, for example how to play simple song with juce.

 

Any tips ?

 

BR


#4

Really the best way to understand it is to spend some time looking at the Juce demo. It has basic examples of pretty much everything. There is code in there that will record and play back an audio file for example, that might be a good place to start. 

I really wish someone would write a book on audio and plug-in programming with Juce. But until then the Demo and other example projects are the best resource. The documentation is also very good, however it's not oriented toward specific tasks you might want to do.


#5

What was the fix?

Did you just include paths to juce modules? I'm sure others are interested.


#6

I am very interested how you did it.


#7

If you call for the definition of objc_msgSendSuper in an INTROJUCER built project - Vs - a new XCode project that JUCE was imported into, you'll find that you're brought to two different fairly heavily macro'd definitions. The trick to compiling for the XCode generated project seems to be to cast the objc_msgSendSuper to the correct function pointer type, and then call it. I'm sure there's a very good reason for this … but regardless ...

So I gave this a go, and I at least got the compile to work, but I must warn folks that I haven't properly tested it yet ( it also appears to be backwards compatible with the INTROJUCER built project ).

    static id sendSuperclassMessage (id self, SEL selector)
    {
        /****** BEING SUPER EXPLICIT TO HELP DEBUGGING IF REQUIRED *****/
        objc_super theSuper = { self, [SuperclassType class] };
        
        /****** CASTING OBJC_MSGSENDSUPER TO THE RIGHT IMPLEMENTATION *****/
        typedef id (*functionPtr)(struct objc_super *, SEL, ...); //defining the function pointer type
        functionPtr theCastFunction = (functionPtr)objc_msgSendSuper; //casting objc_msgSendSuper
        id theReturnedValue = theCastFunction(&theSuper, selector);
        
        return theReturnedValue;
        
        
        /****** ORIGINAL CODE *****
        objc_super s = { self, [SuperclassType class] };
        return objc_msgSendSuper(&s, selector);
        */

        
    }

I'll keep folks know if it keeps working out, but I thought I should at least say something now - just in case anybody else was getting caught on this and at least needed a place to start.

OT


#8

I had to set the option "Enable Strict Checking of objc_msgSendCalls" to "No" to get rid of that error. Xcode defaults it to "Yes" in the new projects.


#9

Thanks for the info!

I've managed to find a horrible hack so that it should all compile and work even if that flag is set.


#10

I’m looking at what options are available for adding JUCE to an existing Storyboard-based iOS app. In my past attempts I did not manage to get it working with Storyboards when starting with a Projucer-generated Xcode project. I don’t know if things have changed in that regard. But the other option I see is creating a static library (it should be all audio no UI).

Anyone have any experience or thoughts on this?


#11

what about the START_JUCE_APPLICATION_WITH_CUSTOM_DELEGATE macro?


#12

Yes I was wondering about that… although I’ve found when trying in the past that some JUCE functionality does not work properly with it.