Issue Passing NSMutableDictionary to Method

Discussion in 'iOS Programming' started by roswell, Apr 3, 2010.

  1. roswell macrumors newbie

    Joined:
    Apr 3, 2010
    #1
    Hello all,

    I'm trying some basic iPhone programming -- all has been going well but recently I've hit a bit of a roadblock. I've got a chunk of code that's passing an NSMutableDictionary (amongst other things) to a method in another class:

    Code:
    [self.shuttle makeAPICallAndReturnResultsUsingMode:@"login" module:@"login" query:credentials];
    
    The NSMutableArray credentials is previously defined a bit above as such:
    Code:
    NSMutableDictionary *credentials = [[NSMutableDictionary alloc] init];
    [credentials setObject:username forKey:@"username"];
    [credentials setObject:password forKey:@"password"];
    The method that receives it looks like such:
    Code:
    -(id)makeAPICallAndReturnResultsUsingMode:(NSString *)mode module:(NSString *)module query:(NSMutableDictionary *)query
    
    From debugging I have determined that the code works fine up until this point within the above method:
    Code:
     [query setObject:self.sessionID forKey:@"session_id"];
    
    At this point, the application terminates -- the Console informs me of this exception:

    This leads me to believe that I must initialize NSMutableDictionary in some way in my new method before I can access it, but I have no idea how. Any advice?
     
  2. teek macrumors member

    teek

    Joined:
    Feb 12, 2008
    Location:
    Norway
    #2
    Post your code. Can't see much from these fragments
     

Share This Page