Accessing Unknown 'ID' class method-Objective C -


rs232msggeteventdescriptions.h:

#define declare_rs232_newmsg(classid)\ enum                                 \ {                                    \ id = classid                         \ };                                   \  @interface rs232msggeteventdescriptions : rs232msg {  } @end 

rs232msggeteventdescriptions.m

@implementation rs232msggeteventdescriptions   declare_rs232_newmsg(rm_get_event_descriptions); @end 

eventlogs.m

-(void)event { service = [cserviceappdlg alloc]; if ([service:(remote_message_id)rs232msggeteventdescriptions.id withevent:pevent])   {     nslog(@"get event descriptions!!");  } } 

i'm getting error "accessing unknown 'id' class method" should not modify definition here.how pass id.i going call different descriptions id in same way declaration of id.

the reason why getting accessing unknown 'id' class method error message because have not declared method called id in class rs232msggeteventdescriptions.

when rs232msggeteventdescriptions.id in code, calling property id of object rs232msggeteventdescriptions, equivalent [rs232msggeteventdescriptions id]. however, rs232msggeteventdescriptions not object, class , don't have class method called + (remote_message_id)id in class specification (you don't have declared on interface or implemented on class implementation).

i point out bad practice use dot notation other property. since classes cannot have @properties (these objects) should call method using standard objective-c messaging notation [rs232msggeteventdescriptions id].

xcode still allow write object.methodname call methods no parameters, , object.methodname = value methods take 1 parameter. because interpreted follows:

object.methodname;  // becomes [object methodname] object.methodname = value;    // becomes [object setmethodname:value] 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -