ARC not works with RODL

Hello,

when trying to convert to ARC the following line faisl:

[__invocation setArgument:&__aReason atIndex:__idx++];

it is something about:
"it is not safe with an object ownership other then… unsafe…

interesting. can you send us the exact RODL you have? i’ve not run into any problems with ARC in any of the RODLs we tested with — several of our internal apps have already been converted to ARC and RO/DA is supposed to be APi compatible with ARC.

you can mail it to support@remobjects.com

thanx.

i have sent an email with the rodl :wink: hf

thanx.

any news?

Hello,

Sorry, I see no problems with it. Please specify:

  • what error do you see, exactly?
  • what RO SDK version and Xcode version do you use?
  • the whole method body around the line that gives the error.

Best regards - Sergey.

i am trying to convert our project to ARC.

-(BOOL)Invoke_OnSendMessage:(ROMessage )aMessage handler:(id)aHandler
{
NSString
__aSenderUserID;
__aSenderUserID = (NSString )[aMessage readAnsiStringWithName:@“aSenderUserID” asClass:[NSString class]];
NSString
__aMessage;
__aMessage = (NSString )[aMessage readAnsiStringWithName:@“aMessage” asClass:[NSString class]];
TObjectRec
__aObjectRec;
__aObjectRec = (TObjectRec *)[aMessage readComplexWithName:@“aObjectRec” asClass:[TObjectRec class]];
BOOL __aIsPrivate;
__aIsPrivate = [aMessage readBooleanWithName:@“aIsPrivate”];

NSMutableString *__selPattern = [NSMutableString stringWithString:@"OnSendMessage"];
for (int i = 1; i <= 4; i++) [__selPattern appendString:@":"];
SEL __selector = NSSelectorFromString(__selPattern);
if ([aHandler respondsToSelector:__selector])
{
	NSMethodSignature *__signature = [aHandler methodSignatureForSelector:__selector];
	NSInvocation *__invocation = [NSInvocation invocationWithMethodSignature:__signature];
	[__invocation setTarget:aHandler];
	[__invocation setSelector:__selector];
	int __idx = 2;
	[__invocation setArgument:&__aSenderUserID atIndex:__idx++];
	[__invocation setArgument:&__aMessage atIndex:__idx++];
	[__invocation setArgument:&__aObjectRec atIndex:__idx++];
	[__invocation setArgument:&__aIsPrivate atIndex:__idx++];
	[__invocation invoke];
	return YES;
}
else return NO;

}

Error of the xcode-converter says: “[rewriter] NSInvocation’s setArgument is not safe to be used with an object with ownership other than __unsafe_unretained”

and the rodl2obj tool has version 6.0.991

Hello,

Thanks for the report, this is an issue. It is the process of fixing now, the codegen template and perhaps the codegen core is affected. As a workaround for now you could do the following: right before each line that references an object type parameter (including strings, they are objects too) declare a void pointer variable than use it together with the __bridge modifier. For example, replace this line:

[__invocation setArgument:&__aMessage atIndex:__idx++];

with this two ones:

void *__aaMessage = (__bridge void *)__aMessage;
[_invocation setArgument:&__aaMessage atIndex:__idx++];

Best regards - Sergey.

Here is the fixed template, the codegen core was not affected.
How to install the template update

Best regards - Sergey.