[[+content_image]]
Y
Y
Yuri2018-01-10 12:38:41
Objective-C
Yuri, 2018-01-10 12:38:41

How to get a response from a method in Objective-C in C#?

There is a method that returns bool the method is written in objective-c, how to get bool property in c#

+ (BOOL)userRatedApp{
         if (forceUnlock){
            [[NSUserDefaults standardUserDefaults] setBool:YES forKey:SaveKey];
            [[NSUserDefaults standardUserDefaults] synchronize];
            return YES;


           }
    #else
    #endif
    BOOL rateNeed = NO;
    if (rateNeed) {
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:SaveKey];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }

    return rateNeed;
    }

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
D
Daniil Basmanov, 2018-01-10
@Abs3akt

You need to create a wrapper on the unit side and specify the correct method signature:

[DllImport ("__Internal")]
private static extern bool userRatedApp();

Read more in the manual here and here .

V
VoidVolker, 2018-01-10
@VoidVolker

bool flag = true;
if(flag)
{
    Console.WriteLine("Flag is true");
}
flag = false;
if(flag == false)
{
    Console.WriteLine("Flag is false");
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question