I am using reflections in my project for Firebase and I am facing an difficulty in access value of id datatype. Consider the below code snippet:
SEL SelobserveEventType=NSSelectorFromString(@"observeEventType:withBlock:"); FIRDataEventType typeFIR=FIRDataEventTypeValue ; NSMethodSignature *observemethodSignature = [ref methodSignatureForSelector:SelobserveEventType]; NSInvocation* observeinvocation = [NSInvocation invocationWithMethodSignature:observemethodSignature]; int myNewwInt; [observeinvocation setSelector:SelobserveEventType]; [observeinvocation setTarget:ref]; [observeinvocation setArgument:&typeFIR atIndex:2]; [observeinvocation setArgument:&ObserveBlockMessages atIndex:3]; [observeinvocation invoke]; [observeinvocation getReturnValue:&ccHandleTOUnSubscribe];
So the return value of ref is being stored at address of ccHandleTOUnSubscribe. Now I am not able to access the value of ccHandleTOUnSubscribe. Whenever I am trying to access value I am encountering a crash with the below error log:
EXC_BAD_ACCESS (code=1, address=0x1)
Even I try to print the value like this:
NSLog(@"the value is %@",ccHandleTOUnSubscribe); //here the code crashes.
I have already tried many things like typecasting it into integer and get the value however I have not yet been successful. Can anyone please suggest me something
Aucun commentaire:
Enregistrer un commentaire