PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Return value from Objective C Procedure
Return value from Objective C Procedure
Débuté par Ben Adams, 04 oct. 2017 15:05 - 2 réponses
Posté le 04 octobre 2017 - 15:05
Hi Guys,

hopefully you can help me, I have created a procedure in Objective C for iOS whereby i pass a string to the procedure and it replaces the ' character with a blank space. This is my code as below:

void REPLACE_CHARACTERS(NSString* ORIG)
{
NSString *str = ORIG;
str = [str stringByReplacingOccurrencesOfString:@"'" withString:@" "];
return str
}

How do i use the 'str' value back in my main project? it doesn't appear i can assign the returned value to a global variable.

Any help is appreciated,

Many thanks

Ben
Posté le 05 octobre 2017 - 15:53
Call your procedure like this

sReturnedString is string = REPLACE_CHARACTERS(sStringPassed)

This is how I retrieve values from JS procedures in WebDev hope it works the same way
Posté le 05 octobre 2017 - 16:20
Hi

You should declare

NSString* REPLACE_CHARACTERS(NSString* ORIG)
instead of void

and it should work

HTH

King