How to use non-ARC infrastructure in ARC iOS app

I have seen the answers to a specific question. Most of the answers are asking for "-fno-objc-arc" to be included.

Let me try to explain the problem.

I have a "MobileCommunicationLibrary.framework" framework that uses a lot of non ARC files like 1) class, subclass NSAutoReleasePool 2) uses save, release

This structure has a header file "MobileCommunicationLibrary.h" that I need to import into the ARC application, and many other header files for which MobileCommunicationLibrary.h has a dependency, such as "VNSAutoReleasePool.

Now I am developing an iOS application "TestIQLNative". It has a class "AppDelegate.h" and "AppDelegate.m" that uses the ARC stuff as a weak property and synthesizes it. This class must use ARC compilation or the compiler flag must be "-fobjc-arc"

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

I get a lot of errors on import related to save, release, NSAutoReleasePool, etc. as they are not ARC.

I can't put "-fno-objc-arc" for AppDelegate.m as it would give an error complaining about the synthesis of a weak property only allowed in ARC.

Can anyone please help?

<Errors and my build phase>

Error and my compile source screenshot

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

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

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

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

<Framework header file required by the application>

Framework Header file required by application

+3


source to share


1 answer


You are not placing this linker flag in the View controller class, but rather setting the flag in the imported library you are using. You achieve this:

  • Inside Xcode, select your project under [GOALS].
  • Select the [Phase Build] tab.
  • Find the library header / class files under Compile Sources.
  • Add a compiler flag to it.


Hope it helps.

+2


source







All Articles