Hi there,
And thanks for a brilliant framework!
I have copied the lines of code form the demo sourcecode for cocoslive, and tries to send scores to the cocoslive server.
I actually works, but if I do it as in the sourcecode, my app crashed at the last line where I release the CLScoreServerPost object.
If I remove this line, the socres are posted fine but next time I try to post a score again (without exiting the game), it gives me an error and no score is posted.
I use Cocos2D 0.99.4 and the CocosLive classes from the same build.
Here is my code :
-(void) endPopText:(id)sender
{
NSLog(@"Preparing score to be sent to CocosLive server!");
// post score to cocoslive network
CLScoreServerPost *server = [CLScoreServerPost serverWithGameName:@" (removed) " gameKey:@" (removed) " delegate:self];
NSMutableDictionary *cc = [[ NSMutableDictionary alloc] init];
[ cc setObject:[NSString stringWithString:@"Twinzel"] forKey:@"cc_playername"];
[ cc setObject:[NSNumber numberWithInt: score] forKey:@"cc_score"];
NSLog(@"Sending score to CocosLive server!");
[server sendScore:cc];
NSLog(@"Releasing Cocoslive server object!");
[server release];
}
// PostScore Delegate
-(void) scorePostOk: (id) sender
{
// Score post successful
NSLog(@"Score sent successfully to server!");
}
-(void) scorePostFail: (id) sender
{
NSString *message = nil;
// score post failed
tPostStatus status = [sender postStatus];
if( status == kPostStatusPostFailed ) {
message = @"Cannot post the score to the server. Retry";
}else if( status == kPostStatusConnectionFailed ) {
message = @"Internet connection not available. Enable wi-fi / 3g to post your scores to the server";
}
NSLog(@"%@", message);
}