Warning encountered when compiling in XCode 4.2

235 views
Skip to first unread message

Victorio Chavarria

unread,
Nov 5, 2011, 8:18:07 PM11/5/11
to IBAForms
First, thanks very much for sharing this code. I use forms extensively
in my app. Prior to finding this gem I'd been coding them myself and
found it to be one of the more difficult parts of my app. Getting the
keyboard, keyboard toolbar, text fields and scrolling integrated and
functioning properly was very time consuming, and the code wasn't very
portable from one form to another. I needed to add a new form for an
update and was really not looking forward to it. Thankfully I found
this project.

Now for my question.

I get the following warning when compiling on XCode 4.2:

Semantic Issue: Conflicting distributed object modifiers on return
type in implementation of 'release'

The warning points to line 42 of IBAInputManager.m which reads:

SYNTHESIZE_SINGLETON_FOR_CLASS(IBAInputManager);

I'm unfamiliar with this warning. Anyone else seen this? Is it
something I need not worry about or is there a recommended fix?

Thanks,

Victorio

Stewart Gleadow

unread,
Nov 5, 2011, 11:18:55 PM11/5/11
to ibaf...@googlegroups.com
Are you using ARC? It sounds like the kind of warning you would get fi ARC was turned on... The synthesize singleton macro overrides release and autorelease, which is probably not allowed with ARC (I'm not an ARC guru though).

You can either turn off ARC for that file (see http://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project), or edit the singleton macro to not override those memory management methods.

I'm usually not that strict with ensuring my singleton objects can only ever be created once like this... I just make a class method to return a singleton instance, but don't ticker with anything else in the class. In most cases it works fine, unless you forget to use the singleton and make your own instance for some reason.

- Stew

Jesse Collis

unread,
Nov 5, 2011, 10:17:37 PM11/5/11
to ibaf...@googlegroups.com
It's an issue with the synth singleton macro that IBAForms uses, the original author may have a fix for it, but I've seen the same issue in other projects that use that macro.

If I have time I'll have a look at it


-JC

Sent from my iPhone

Victorio Chavarria

unread,
Nov 6, 2011, 12:23:56 AM11/6/11
to IBAForms
I'm not using ARC, but I tried turning it off anyway for the
IBAInputManager.m file as per the instructions at the Stack Overflow
link provided below and I get the same warning. In fact, I get the
warning even when I build the forms showcase example project from
GitHub. I haven't modified any of the IBAForms code.

I should note that the code runs fine, but in general I don't like
shipping code which generates warnings.

On a side note, the code in SynthsizeSingleton.h (where
SYNTHESIZE_SINGLETON_FOR_CLASS is defined) uses a syntactical element
(the single \ character) which I'm unfamiliar with. What's the purpose
of the backslash?

Victorio

On Nov 5, 10:18 pm, Stewart Gleadow <sglea...@gmail.com> wrote:
> Are you using ARC? It sounds like the kind of warning you would get fi ARC was turned on... The synthesize singleton macro overrides release and autorelease, which is probably not allowed with ARC (I'm not an ARC guru though).
>
> You can either turn off ARC for that file (seehttp://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-...), or edit the singleton macro to not override those memory management methods.

Oliver Jones

unread,
Nov 6, 2011, 12:39:32 AM11/6/11
to ibaf...@googlegroups.com
Change the release implementation in the SYNTHESIZE_SINGLETON_FOR_CLASS macro to this:

- (oneway void)release { }

Apple changed the method declaration (or LLVM is more strict about it).  It relates to distributed objects.

See this stack overflow post for a discussion about it:

Regards

Victorio Chavarria

unread,
Nov 6, 2011, 1:05:54 AM11/6/11
to IBAForms
That did it. Thank you.

Victorio

On Nov 5, 11:39 pm, Oliver Jones <oli...@ittybittyapps.com> wrote:
> Change the release implementation in the SYNTHESIZE_SINGLETON_FOR_CLASS macro to this:
>
> - (oneway void)release { }
>
> Apple changed the method declaration (or LLVM is more strict about it).  It relates to distributed objects.
>
> See this stack overflow post for a discussion about it:http://stackoverflow.com/questions/5494981/use-case-of-oneway-void-in...

Sadat Rahman

unread,
Nov 6, 2011, 2:53:51 PM11/6/11
to ibaf...@googlegroups.com

On 06/11/2011, at 3:23 PM, Victorio Chavarria wrote:

> On a side note, the code in SynthsizeSingleton.h (where
> SYNTHESIZE_SINGLETON_FOR_CLASS is defined) uses a syntactical element
> (the single \ character) which I'm unfamiliar with. What's the purpose
> of the backslash?

Line continuation character.

Aravind R

unread,
Dec 11, 2012, 10:37:23 AM12/11/12
to ibaf...@googlegroups.com

Hi ,

      Just went through your review. I also had additional problem with this singleton file.First i need to discuss your issue !!

If ARC set YES in build settings tab under Apple LLVM compiler 3.0 Language &  warnings , set to NO.
OR Else
 if you want to set ARC disabled fo particular file go to Build phases tab and select compile sources double click on the file you want to disable ARC and paste the following 

-fno-objc-arc

Here comes my issue ,

When all the above steps satisfied we can get successful build without ARC, 


how can i get the ARC applied only for header files like the SynthesizeSingleton.h since when i disable the ARC in build settings tab other header files that already converted to ARC resulted in exception during compilation, how can i solve this!!!
Reply all
Reply to author
Forward
0 new messages