我正在尝试在函数之外以及类之外访问 nsstring 数据。
如何useridStr
在函数和类之外访问?这是我的代码:
-(id)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSString *loginStatus = [[NSString alloc] initWithBytes:[webData mutableBytes]
length:[webData length] encoding:NSUTF8StringEncoding];
NSDictionary *loginDict = [[loginStatus JSONValue] objectForKey:@"UserDetails"];
NSArray *userId = [loginDict valueForKey: @"userid"];
NSString *useridStr = [userId lastObject];
NSLog(@"--------------....%@", useridStr);
}