title: Passing String Between Two Classes Is Not Working Properly
body: <p>I am working with Google's Places API for iOS, and I need to pass a string from one of the classes (GooglePlacesConnection) to GooglePlacesObject.</p>
  
  <p>Here, in the first class, I set distanceMatrixURL equal to the string timeURL</p>
  
  <pre><code> timeURL = [NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/distancematrix/json?origins=%f,%f&amp;destinations=%@,%@&amp;sensor=true",userLat,userLng,destLat,destLng];
  
                  GooglePlacesObject *googleplacesobject = [[GooglePlacesObject alloc]init];
  
                  googleplacesobject.distanceMatrixURL = timeURL;
                  NSLog(@"pullurl is %@",  googleplacesobject.distanceMatrixURL);
  </code></pre>
  
  <p>and the NSLog prints out googleplacesobject.distanceMatrixURL correctly.
  However, in the second class, when I do </p>
  
  <pre><code>-(void)distanceMatrix{
  
  NSLog(@"%@",distanceMatrixURL);
  
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:distanceMatrixURL]
                                                         cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                     timeoutInterval:10];
  
  
  _connection2 = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
  [_connection2 start];
  if (_connection2)
  {
      responseData2 = [NSMutableData data];
      connectionIsActive = YES;
      NSLog(@"connection is active with %@", responseData2);
  } else {
      NSLog(@"connection failed");
  }
  }
  </code></pre>
  
  <p>the NSLog of NSLog(@"%@",distanceMatrixURL); is (null)</p>