passing out parameter

后端 未结 2 730
深忆病人
深忆病人 2021-01-07 23:35

I wrote a method with an out parameter:

-(NSString *)messageDecryption:(NSString *)receivedMessage outParam:(out)messageCondent
{   
    messageCondent = [re         


        
2条回答
  •  心在旅途
    2021-01-07 23:47

    Create the method to accept a pointer to the object.

    -(NSString *)messageDecryption:(NSString *)receivedMessage outParam:(NSString**)messageCondent
    {   
        *messageCondent = [receivedMessage substringFromIndex:2];
        return [receivedMessage substringToIndex:1];
    
    }
    

    Pass in the reference to the local object.

    NSString *messageCondent = nil;
    NSString *mode = [myclassobject messageDecryption:message outParam:&messageCondent];
    

提交回复
热议问题