Illegal Start of Token iOS

7912
5
08-29-2014 08:47 AM
KyleDunaway
New Contributor III

I keep getting this error when adding features.

I have two feature layers, and I am adding and updating features on them from an iOS app.

When I call add/update/deleteFeatures and check the didFailFeatureEditsWithError, the error is:

Illegal Start of Token.

The interesting thing is that some requests to update work, and some fail.  In the controller I am calling 3-4 updates.

Any ideas what this means?

Thanks

0 Kudos
5 Replies
GaryMorris1
Occasional Contributor

When you make a network request and try to parse the JSON response you get this error if the response is not JSON. 

I've seen this most commonly when you get a HTML response (which starts with "<").  When that happens the error is "Illegal start of token [<]".  You can examine the UserInfo field in the NSError to see the actual responseString which might help you figure out what's wrong.

Error Domain=org.domain.AGSSBJsonParser.ErrorDomain Code=0 "Illegal start of token [<]" UserInfo=0x19f7b130 {responseString=

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1">

...

0 Kudos
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi Kyle,

I wonder have you try over cellular network, or just on company wifi? This issue seems to be coming from the firewall.

0 Kudos
KyleDunaway
New Contributor III

I have been testing on the simulator over an ethernet connection.

Also have been testing on iPhone/iPad devices over a cellular network, hooked up to XCode to report errors.

Also have been running over a wi-fi hotspot through Verizon.

There seems to be no pattern to the errors.  Sometimes everything will work perfect for a couple hours.  Then sometimes a few update calls wont execute and

- (void)featureLayer:(AGSFeatureLayer *)featureLayer operation:(NSOperation *)op didFeatureEditsWithResults:(AGSFeatureLayerEditResults *)editResults

will return a editResults.success of false.

I've been trying to replicate the error and use

- (void) featureLayer:(AGSFeatureLayer *)featureLayer operation:(NSOperation *)op didFailFeatureEditsWithError:(NSError *)error

{

    NSLog(@"Error for %@", featureLayer.name);

    NSLog(@"%@", [error localizedDescription]);

    NSLog(@"%@", [error userInfo]);

}

to get some information.  If/When it errors again I will post the results of the didFail NSLogs.

Thanks for your help.

0 Kudos
RaviKrishna
New Contributor

We have encountered the error "Illegal start of token <5" and were able to identify the problem to attachments with features added from Gallery/Library of the Mobile devices (iOS 8x in our case). Pictures taken while using the Collector App sync fine, however any picture added from gallery returns this error.

Regards,

Ravi.

Environment Agency- Abu Dhabi.

0 Kudos
MichaelDavis3
Occasional Contributor III

We are also seeing these errors, especially when checking offline databases from Collector or Runtime apps.  We've also noticed that if we try to edit the data in ArcGIS we get "edit buffer returned no data" errors.  For us the issue can be corrected by stopping services, deleting the database archive, and recreating it... however we still can't nail down the cause.  it happens frequently enough these days that it is a major concern for deploying apps. 

0 Kudos