extension response array out of order

Post here all your questions related with the SmartFoxServer iPhone API

Moderators: Lapo, Bax

Posts: 4
Joined: 24 Jan 2010, 00:03

extension response array out of order

Postby david87 » 21 Feb 2010, 20:47

I am developing an iPhone application using SFS Pro and the iPhone API. Everything has been running smoothly but I am running into a bizarre situation. Part of the iphone application involves displaying a scoreboard. An SFS extension sends the data in an array to be displayed to the iPhone. However, when I receive the array in onExtensionResponse it is out of order if the number of elements is 5 or more. For 1-4 elements, it is backwards.

Here is what I have on the SFS extension:

var response = {}
response._cmd = "getDailyResults"
response.result = []


_server.sendResponse(response, -1, null, [user])

I check to make sure that the response.result array is correct, so I trace it before sending and it displays "one" through "eight" in the proper order.

On the iphone side, I have:

-(void) onExtensionResponse:(INFSmartFoxSFSEvent *)evt {

NSDictionary *response = evt.params;
NSDictionary *theData = [response objectForKey:@"dataObj"];
NSString *command = [theData objectForKey:@"_cmd"];

if ([command isEqualToString:@"getDailyResults"]) {
NSArray *results = [theData objectForKey:@"result"];

for (int i=0; i<[results count]; i++) {
NSLog(@"%@", [results objectAtIndex:i]);


When I look at the iphone console I get:

2010-02-21 13:00:19.680 [8779:207] four
2010-02-21 13:00:19.682 [8779:207] three
2010-02-21 13:00:19.682 [8779:207] two
2010-02-21 13:00:19.683 [8779:207] one
2010-02-21 13:00:19.684 [8779:207] eight
2010-02-21 13:00:19.685 [8779:207] seven
2010-02-21 13:00:19.686 [8779:207] six
2010-02-21 13:00:19.687 [8779:207] five

The same thing happens if I use the integers 1-8 as opposed to strings.

Any ideas? Why are the indices shuffled?

Return to “iPhone Objective-C API”

Who is online

Users browsing this forum: No registered users and 1 guest