Skip to content

Instantly share code, notes, and snippets.

@Alos
Created January 26, 2011 04:14
Show Gist options
  • Save Alos/796218 to your computer and use it in GitHub Desktop.
Save Alos/796218 to your computer and use it in GitHub Desktop.
-(void)getUserData{
var app = [CPApp delegate];
var aURL = [app serverIP] + "/GetUserData";
CPLog.info("Getting User data at: %s", aURL);
var request = [CPURLRequest requestWithURL:aURL];
xyzConnection = [CPURLConnection connectionWithRequest:request delegate:self];
}
- (void)connection:(CPURLConnection) connection didReceiveData:(CPString)data
{
var info = JSON.parse(data);
if(!response.error){
CPLog.info("Got user: "+ response);
var user = [[XYZUser alloc] init];
//now that we have the song we return it
var info = [CPDictionary dictionaryWithObject:user forKey:"UserData"];
[[CPNotificationCenter defaultCenter] postNotificationName:"UserDataReceived" object:self userInfo:info];
}else{
//no user was found lets ask the new user stuff
CPLog.info("No UserData found in data!");
}
}
-(void)connectionDidFinishLoading:(CPURLConnection)connection{
//nothing
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment