Get Objective-C Value in C wrapper (Unity Plugin)

ios objective-c c unity3d

135 просмотра

1 ответ

1 Репутация автора

I'm not familiar with Objecticve-C. I'm using it because I want to natively/correctly check if an app is installed on ios. I found the Objective-C snippet to see if an app is installed and understand needing a C-wrapper to basically have unity talk to the Objective-C script (mm file). Just don't understand how to get the C-wrapper to get the Objective-C value I have within my mm script.

// Created by OJ on 7/13/16.
#import <Foundation/Foundation.h>  
@interface SampleClass:NSObject
/* method declaration */
- (BOOL)isFBInstalledX;

@implementation SampleClass

//Objective-C value I want      
- (BOOL)isFBInstalledX {
return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]];


//C-wrapper that talks to Unity
extern "C"
bool isFBInstalled(){

// Need to get the Objective C BOOL value from above, my c# script will get this value once retrieved

//return -(Bool) isFBInstalledX value  //--this doesn't work
//return ..... // I give up  :(


Автор: OJ3D Источник Размещён: 18.07.2016 04:30

Ответы (1)

0 плюса

1 Репутация автора


Got the Answer! - Objective-C to UnityPlugin - App Installed Status

Автор: OJ3D Размещён: 20.07.2016 02:39
Вопросы из категории :