Slayes
Slayes

Reputation: 445

Objective C : Use of undeclared identifier

Helo,

I use WM for my developpement. WM create this code in 'WDObjectiveC.mm':

#include <stdint.h>
#import <UIKit/UIKit.h>
#import <Exe/www/lib/wdHTML.h>

void activeDelegate(void*);
bool RetourObjC(NSString*,NSString*);
void activeDelegate(void*nHandleChampWM) {
    UIView*ChampWM= (UIView*)nHandleChampWM;
    UIWebView*myView= (UIWebView*)[ChampWM subviews][0];
    [myView setDelegate: [wdHTML new]]    
    NSLog(@"activé");
    RetourObjC(@"JS",@"test");
}

...

bool RetourObjC(NSString* p0,NSString* p1){
    IExternalCall* call = AllocExternalCall(0x136a26740038d376ll,2);
    call->Push(0,&p0,16);
    call->Push(1,&p1,16);
    bool r = *(bool*)call->Call();
    call->Release();
    return r;
}

...

'RetourObjC' is a function that i have created in WM, this function execute a code in WLanguage. When i call RetourObjC here, there isn't problem.

But i have created a class :

@interface wdHTML : UIWebView <UIWebViewDelegate> { }
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType ;
@end

@implementation wdHTML
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
    if (navigationType == UIWebViewNavigationTypeLinkClicked) {
        NSLog(@"Enter");
        NSURL *URL = [request URL];
    RetourObjC(@"JS",@"test");

        return NO;
    } 
    return YES; 

}
@end

When i called the function RetourObjC in this class, i have one error : Use of undeclared identifier 'RetourObjC'.

SOS please, i don't find any solution on google (i'm new in the developpement for IOS)

Upvotes: 0

Views: 1941

Answers (1)

Caleb
Caleb

Reputation: 124997

The problem is that your function isn't visible from the wdHTML class. Move the prototype to a header file:

// WDObjectiveC.h

bool RetourObjC(NSString*,NSString*);

and then #import that file in your class:

// wdHTML.m

#import "WDObjectiveC.h"

Upvotes: 1

Related Questions