loadBalancing-objc and swift

hello there, folks!

After some play with SDK and checking demo projects ( that is written in swift ), so I decided to add photon to my project. (it have some pods and dependencies already)
It first attempt it just won't compile at all, but after some research i'am successfully added all libs and linking stuff to build settings ( including relative paths and all other stuff - tried to copy and set everything like in swift demo), but I am getting ARC errors like this :
'autorelease' is unavailable: not available in automatic reference counting mode

first error is in EGRoomOptions.mm line 40 . There are so many errors that i'am getting
Too many errors emitted, stopping now

But if i'am changing build settings :
Apple Clang - Language - Objective-C
- Objective-C Automatic Reference Counting to NO - all the error are silenced.

But in demo project ARC is turned on and everything works just fine.
How could I fix this issue?

Comments

  • find another workaround by adding
    -fno-objc-arc
    
    to some files in build phases
  • Kaiserludi
    Kaiserludi admin
    edited June 29
    Hi @etovoda.


    EGRoomOptions.mm is part of the LoadBalancing-obj project, that builds the LoadBalancing-obj .lib, to which the demo links to and to which your project also needs to link to.
    That project unlike the demo is build with ARC turned off.

    You should NOT add the source code of LoadBalancing-obj to your own project.

    Normally you don't need to touch that lib at all and just let your project link to it, but in the rare case that you want to modify it, you can add it as dependency to your project (drag and drop the .xcodeproj file from finder into your project in the Xcode project navigator (the left tab in Xcode, where you can see the files in your project/workspace) and then go to the 'Build Phases' tab of each of your projects targets and add the LoadBalancing-objc lib there under 'Dependencies'). This way it will automatically get rebuilt, if you build your own project and have changed any source code inside LoadBalancing-objc.
    By doing it this way instead of adding the LoadBalancing-objc source files to your project, you assure that LoadBalancing-objc is built with its own project settings and not with the ones of your own project, which for ARC means that LoadBalancing-objc will be built with ARC turned off, even when you build your own project with ARC turned on.
  • Thanks a lot!