seba_sencha
seba_sencha

Reputation: 205

How to use non ARC framework in ARC iOS application

I saw some replies to exact question. Most replies asking to include "-fno-objc-arc".

Let me try to explain the issue.

I have a framework "MobileCommunicationLibrary.framework" which uses lot of non ARC stuff like 1) class which subclass NSAutoReleasePool 2) uses retain, release

This framework has a headerfile "MobileCommunicationLibrary.h" which I need to import in the ARC application and lot of other headerfiles which MobileCommunicationLibrary.h has dependency like "VNSAutoReleasePool.

Now I am developing an iOS application "TestIQLNative". This has class "AppDelegate.h" and "AppDelegate.m" which uses ARC stuff like weak property and synthesizing it. This class has to use ARC compiling or compiler flag has to be "-fobjc-arc"

Also, I need to import <MobileCommunicationLibrary/MobileCommunicationLibrary.h> to AppDelegate.h to use methods provided by the framework.

When I import I am getting lot of errors related to retain, release, NSAutoReleasePool etc as they are non ARC.

I wont be able to put "-fno-objc-arc" for AppDelegate.m as that would give error complaining synthesizing weak property allowed only in ARC.

Can someone help?

< Errors and my Build phase >

Error and my compile source screenshot

< One of the errors in the header file which uses non ARC code in header files >

One of the errors in the header file which uses non ARC code in header files

< Framework header files and including one header file in Appdelegate.h >

Framework header files and including one header file in Appdelegate.h

< Framework Header file required by application >

Framework Header file required by application

Upvotes: 3

Views: 1250

Answers (1)

ninehundreds
ninehundreds

Reputation: 1105

You don't put that linker flag into the View controller's class, but rather set the flag on the imported library you're using. You accomplish this by:

  1. Within Xcode select your project under [TARGETS].
  2. Select the [Build Phases] tab.
  3. Find the library's header / class files under 'Compile Sources'.
  4. Add the compiler flag to it.

Hope this helps.

Upvotes: 2

Related Questions