5

Most of the security and penetration tools report if the ARC is not enabled.

fobjc-arc flag is not Found 

As far as I know we can't do this in xamarin because we don't have build settings here.

This flag can be set in build settings only.

Even if we could , it won't work because xamarin uses C# and MRC to manage memory by itself.

Can anybody explain me how it can be done or not done or my understanding is wrong

Edit:

We can turn on ARC to a full project by build settings

CLANG_ENABLE_OBJC_ARC=YES

But there is no way to do this in xam studio ... setting the value in mtouch also throws error

Shiva
  • 545
  • 1
  • 10
  • 41
  • I have 0 experience with those flags but looking at [this](https://forums.xamarin.com/discussion/comment/123519/#Comment_123519) it looks like you should be able to include those flags (in some form) in the mtouch arguments text field within your Xamarin.iOS project properties (on the build tab), but maybe they are referring to something else entirely. Is that what you already tried? What error did you get? – hvaughan3 May 02 '17 at 16:43
  • 1
    Actually, just found [this](https://forums.xamarin.com/discussion/comment/72923/#Comment_72923) which tells you how to properly include those flags in that mtouch text field. So try specifying: `-gcc_flags "-fobjc-arc"` – hvaughan3 May 02 '17 at 16:50
  • fobjc-arc is for doing it for a single Objective C file but for a project ... CLANG_ENABLE_OBJC_ARC for all the objective c files... LLVM reads the flag and does it – Shiva May 02 '17 at 16:52
  • here is the error that I got /Users/Shiva/Documents/testproj/testproj.iOS/MTOUCH: Error MT0008: You should provide one root assembly only, found 4 assemblies: 'CLANG_ENABLE_OBJC_ARC', '=', 'YES', '/Users/Shiva/Documents/testproj/testproj.iOS/bin/iPhone/Debug/testproj.iOS.exe' (MT0008) (testproj.iOS) – Shiva May 02 '17 at 16:58
  • But if you specify it within the mtouch text field, which specific Objective-C file would the flag pertain to? I would assume it would pertain to all of them at that point since it is not pointed to any specific one...? – hvaughan3 May 02 '17 at 16:58
  • Boss but as I am using xamarin .c# so no. objective c codign I am doing .. but xamarin c# apis will call objective c apis inturn and i want the object api to be managed by arc not mrc – Shiva May 02 '17 at 17:00
  • 1
    @jstedfast Could you perhaps shed some light on this? – hvaughan3 May 02 '17 at 17:02
  • 1
    @hvaughan3 - **CLANG_ENABLE_OBJC_ARC=YES** eventually passes the **-fobjc-arc** flag to compiler so -gcc_flags "-fobjc-arc" should work.Here is the [reference](https://pewpewthespells.com/blog/buildsettings.html#clang_enable_objc_arc) – Durai Amuthan.H May 02 '17 at 17:35
  • 1
    Speaking of native iOS, setting **-fobjc-arc** for individual file should work for individual files in a Non-ARC project but when you want to turn the complete project into ARC or Non-ARC based one then in xcode you will be turning on and off for **CLANG_ENABLE_OBJC_ARC** .. this is just a convinence provided by xcode but eventually it boils down to -fobjc-arc flag – Durai Amuthan.H May 02 '17 at 17:43
  • Ok then this is what I want ... Thank you all – Shiva May 02 '17 at 20:28
  • @hvaughan3 I think it'll work ..Any of you guys can post it as answer I will accept it – Shiva May 03 '17 at 18:12

1 Answers1

3

Add the following to the Additional mtouch arguments text field within the Xamarin.iOS project properties window:

-gcc_flags "-fobjc-arc"
hvaughan3
  • 10,955
  • 5
  • 56
  • 76