Created
January 26, 2011 04:14
-
-
Save Alos/796218 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(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