Invalid value around character 0, NSJSONSerialization
I make a get from my server and I get a valid response:
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
// Append the new data to the instance variable you declared
//[_responseData appendData:data];
NSString *responseBody = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@",responseBody);
if(data != NULL)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
(unsigned long)NULL), ^(void) {
NSError *error = nil;
//NSMutableArray *jsonArray = [[CJSONDeserializer deserializer] deserializeAsArray:[responseBody dataUsingEncoding:NSUTF8StringEncoding] error:&error];
NSMutableArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
if (error)
{
NSLog(@"JSONObjectWithData error: %@", error);
[delegate onErrorGetArrayFromServer];
}
else
[self parseJSON:jsonArray];
});
}
else
{
if([delegate respondsToSelector:@selector(onErrorGetArrayFromServer)])
{
[delegate onErrorGetArrayFromServer];
}
}
}
The response is like:
[{"id":"37",
"id_estado":"1",
"id_categoria":"1",
"nombre":"fer",
"email":"asd@gmail.com",
"fecha":"2014-07-16 11:25:00",
"observaciones":"as dasd asdasd sasd",
"latitud":"37.619636",
"longitud":"-4.318449",
"foto":"images/default.jpg"},
{"id":"36",
"id_estado":"1",
"id_categoria":"6",
"nombre":"Fernando",
"email":"",
"fecha":"2014-07-16 10:32:45",
"observaciones":"que",
"latitud":"37.6178690439634",
"longitud":"-4.3238141387701",
"foto":"images/default.jpg"}]
It throws me the error:
JSONObjectWithData error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 0.) UserInfo=0x9e0f610 {NSDebugDescription=Invalid value around character 0.}
I tried with other library (CJSON) and it throw me the error:
JSONObjectWithData error: Error Domain=kJSONScannerErrorDomain Code=-202 "Could not scan array. Could not scan a value." UserInfo=0xa15c0e0 {snippet=!HERE>![{"id":"37","id_esta, location=0, NSLocalizedDescription=Could not scan array. Could not scan a value., character=0, line=0}
My server is a REST server and for my Android aplication works well.
_SOLVED_
Thanks to @Himanshu Joshi:
Why are you parsing the data in didReceiveData:? Data is not downloaded completely there, you have to append the data there. Parse the data in connectionDidFinishLoading: delegate method –
I parsed the data in connectionDidFinishLoading: and everything go fine.
ios ios7 nsjsonserialization
add a comment |
I make a get from my server and I get a valid response:
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
// Append the new data to the instance variable you declared
//[_responseData appendData:data];
NSString *responseBody = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@",responseBody);
if(data != NULL)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
(unsigned long)NULL), ^(void) {
NSError *error = nil;
//NSMutableArray *jsonArray = [[CJSONDeserializer deserializer] deserializeAsArray:[responseBody dataUsingEncoding:NSUTF8StringEncoding] error:&error];
NSMutableArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
if (error)
{
NSLog(@"JSONObjectWithData error: %@", error);
[delegate onErrorGetArrayFromServer];
}
else
[self parseJSON:jsonArray];
});
}
else
{
if([delegate respondsToSelector:@selector(onErrorGetArrayFromServer)])
{
[delegate onErrorGetArrayFromServer];
}
}
}
The response is like:
[{"id":"37",
"id_estado":"1",
"id_categoria":"1",
"nombre":"fer",
"email":"asd@gmail.com",
"fecha":"2014-07-16 11:25:00",
"observaciones":"as dasd asdasd sasd",
"latitud":"37.619636",
"longitud":"-4.318449",
"foto":"images/default.jpg"},
{"id":"36",
"id_estado":"1",
"id_categoria":"6",
"nombre":"Fernando",
"email":"",
"fecha":"2014-07-16 10:32:45",
"observaciones":"que",
"latitud":"37.6178690439634",
"longitud":"-4.3238141387701",
"foto":"images/default.jpg"}]
It throws me the error:
JSONObjectWithData error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 0.) UserInfo=0x9e0f610 {NSDebugDescription=Invalid value around character 0.}
I tried with other library (CJSON) and it throw me the error:
JSONObjectWithData error: Error Domain=kJSONScannerErrorDomain Code=-202 "Could not scan array. Could not scan a value." UserInfo=0xa15c0e0 {snippet=!HERE>![{"id":"37","id_esta, location=0, NSLocalizedDescription=Could not scan array. Could not scan a value., character=0, line=0}
My server is a REST server and for my Android aplication works well.
_SOLVED_
Thanks to @Himanshu Joshi:
Why are you parsing the data in didReceiveData:? Data is not downloaded completely there, you have to append the data there. Parse the data in connectionDidFinishLoading: delegate method –
I parsed the data in connectionDidFinishLoading: and everything go fine.
ios ios7 nsjsonserialization
1
Looks like some rubbish data before the opening '['. NSLog the NSData that you received and show us the first dozen bytes.
– gnasher729
Jul 17 '14 at 11:11
[{"id":"37","id_estado":"1","id_categoria":...
– ƒernando Valle
Jul 17 '14 at 11:14
4
Why are you parsing the data indidReceiveData:? Data is not downloaded completely there, you have to append the data there. Parse the data inconnectionDidFinishLoading:delegate method
– Himanshu Joshi
Jul 17 '14 at 11:42
I love u man, I wasted my morning for this stupid error :D
– ƒernando Valle
Jul 17 '14 at 11:48
@ƒernandoValle: What you logged was characters. Not bytes. I can see if bytes are wrong. I can't see if characters are wrong.
– gnasher729
Feb 4 '16 at 12:37
add a comment |
I make a get from my server and I get a valid response:
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
// Append the new data to the instance variable you declared
//[_responseData appendData:data];
NSString *responseBody = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@",responseBody);
if(data != NULL)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
(unsigned long)NULL), ^(void) {
NSError *error = nil;
//NSMutableArray *jsonArray = [[CJSONDeserializer deserializer] deserializeAsArray:[responseBody dataUsingEncoding:NSUTF8StringEncoding] error:&error];
NSMutableArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
if (error)
{
NSLog(@"JSONObjectWithData error: %@", error);
[delegate onErrorGetArrayFromServer];
}
else
[self parseJSON:jsonArray];
});
}
else
{
if([delegate respondsToSelector:@selector(onErrorGetArrayFromServer)])
{
[delegate onErrorGetArrayFromServer];
}
}
}
The response is like:
[{"id":"37",
"id_estado":"1",
"id_categoria":"1",
"nombre":"fer",
"email":"asd@gmail.com",
"fecha":"2014-07-16 11:25:00",
"observaciones":"as dasd asdasd sasd",
"latitud":"37.619636",
"longitud":"-4.318449",
"foto":"images/default.jpg"},
{"id":"36",
"id_estado":"1",
"id_categoria":"6",
"nombre":"Fernando",
"email":"",
"fecha":"2014-07-16 10:32:45",
"observaciones":"que",
"latitud":"37.6178690439634",
"longitud":"-4.3238141387701",
"foto":"images/default.jpg"}]
It throws me the error:
JSONObjectWithData error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 0.) UserInfo=0x9e0f610 {NSDebugDescription=Invalid value around character 0.}
I tried with other library (CJSON) and it throw me the error:
JSONObjectWithData error: Error Domain=kJSONScannerErrorDomain Code=-202 "Could not scan array. Could not scan a value." UserInfo=0xa15c0e0 {snippet=!HERE>![{"id":"37","id_esta, location=0, NSLocalizedDescription=Could not scan array. Could not scan a value., character=0, line=0}
My server is a REST server and for my Android aplication works well.
_SOLVED_
Thanks to @Himanshu Joshi:
Why are you parsing the data in didReceiveData:? Data is not downloaded completely there, you have to append the data there. Parse the data in connectionDidFinishLoading: delegate method –
I parsed the data in connectionDidFinishLoading: and everything go fine.
ios ios7 nsjsonserialization
I make a get from my server and I get a valid response:
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
// Append the new data to the instance variable you declared
//[_responseData appendData:data];
NSString *responseBody = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@",responseBody);
if(data != NULL)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
(unsigned long)NULL), ^(void) {
NSError *error = nil;
//NSMutableArray *jsonArray = [[CJSONDeserializer deserializer] deserializeAsArray:[responseBody dataUsingEncoding:NSUTF8StringEncoding] error:&error];
NSMutableArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
if (error)
{
NSLog(@"JSONObjectWithData error: %@", error);
[delegate onErrorGetArrayFromServer];
}
else
[self parseJSON:jsonArray];
});
}
else
{
if([delegate respondsToSelector:@selector(onErrorGetArrayFromServer)])
{
[delegate onErrorGetArrayFromServer];
}
}
}
The response is like:
[{"id":"37",
"id_estado":"1",
"id_categoria":"1",
"nombre":"fer",
"email":"asd@gmail.com",
"fecha":"2014-07-16 11:25:00",
"observaciones":"as dasd asdasd sasd",
"latitud":"37.619636",
"longitud":"-4.318449",
"foto":"images/default.jpg"},
{"id":"36",
"id_estado":"1",
"id_categoria":"6",
"nombre":"Fernando",
"email":"",
"fecha":"2014-07-16 10:32:45",
"observaciones":"que",
"latitud":"37.6178690439634",
"longitud":"-4.3238141387701",
"foto":"images/default.jpg"}]
It throws me the error:
JSONObjectWithData error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 0.) UserInfo=0x9e0f610 {NSDebugDescription=Invalid value around character 0.}
I tried with other library (CJSON) and it throw me the error:
JSONObjectWithData error: Error Domain=kJSONScannerErrorDomain Code=-202 "Could not scan array. Could not scan a value." UserInfo=0xa15c0e0 {snippet=!HERE>![{"id":"37","id_esta, location=0, NSLocalizedDescription=Could not scan array. Could not scan a value., character=0, line=0}
My server is a REST server and for my Android aplication works well.
_SOLVED_
Thanks to @Himanshu Joshi:
Why are you parsing the data in didReceiveData:? Data is not downloaded completely there, you have to append the data there. Parse the data in connectionDidFinishLoading: delegate method –
I parsed the data in connectionDidFinishLoading: and everything go fine.
ios ios7 nsjsonserialization
ios ios7 nsjsonserialization
edited Feb 4 '16 at 11:37
ƒernando Valle
asked Jul 17 '14 at 11:06
ƒernando Valleƒernando Valle
2,28052750
2,28052750
1
Looks like some rubbish data before the opening '['. NSLog the NSData that you received and show us the first dozen bytes.
– gnasher729
Jul 17 '14 at 11:11
[{"id":"37","id_estado":"1","id_categoria":...
– ƒernando Valle
Jul 17 '14 at 11:14
4
Why are you parsing the data indidReceiveData:? Data is not downloaded completely there, you have to append the data there. Parse the data inconnectionDidFinishLoading:delegate method
– Himanshu Joshi
Jul 17 '14 at 11:42
I love u man, I wasted my morning for this stupid error :D
– ƒernando Valle
Jul 17 '14 at 11:48
@ƒernandoValle: What you logged was characters. Not bytes. I can see if bytes are wrong. I can't see if characters are wrong.
– gnasher729
Feb 4 '16 at 12:37
add a comment |
1
Looks like some rubbish data before the opening '['. NSLog the NSData that you received and show us the first dozen bytes.
– gnasher729
Jul 17 '14 at 11:11
[{"id":"37","id_estado":"1","id_categoria":...
– ƒernando Valle
Jul 17 '14 at 11:14
4
Why are you parsing the data indidReceiveData:? Data is not downloaded completely there, you have to append the data there. Parse the data inconnectionDidFinishLoading:delegate method
– Himanshu Joshi
Jul 17 '14 at 11:42
I love u man, I wasted my morning for this stupid error :D
– ƒernando Valle
Jul 17 '14 at 11:48
@ƒernandoValle: What you logged was characters. Not bytes. I can see if bytes are wrong. I can't see if characters are wrong.
– gnasher729
Feb 4 '16 at 12:37
1
1
Looks like some rubbish data before the opening '['. NSLog the NSData that you received and show us the first dozen bytes.
– gnasher729
Jul 17 '14 at 11:11
Looks like some rubbish data before the opening '['. NSLog the NSData that you received and show us the first dozen bytes.
– gnasher729
Jul 17 '14 at 11:11
[{"id":"37","id_estado":"1","id_categoria":...
– ƒernando Valle
Jul 17 '14 at 11:14
[{"id":"37","id_estado":"1","id_categoria":...
– ƒernando Valle
Jul 17 '14 at 11:14
4
4
Why are you parsing the data in
didReceiveData:? Data is not downloaded completely there, you have to append the data there. Parse the data in connectionDidFinishLoading: delegate method– Himanshu Joshi
Jul 17 '14 at 11:42
Why are you parsing the data in
didReceiveData:? Data is not downloaded completely there, you have to append the data there. Parse the data in connectionDidFinishLoading: delegate method– Himanshu Joshi
Jul 17 '14 at 11:42
I love u man, I wasted my morning for this stupid error :D
– ƒernando Valle
Jul 17 '14 at 11:48
I love u man, I wasted my morning for this stupid error :D
– ƒernando Valle
Jul 17 '14 at 11:48
@ƒernandoValle: What you logged was characters. Not bytes. I can see if bytes are wrong. I can't see if characters are wrong.
– gnasher729
Feb 4 '16 at 12:37
@ƒernandoValle: What you logged was characters. Not bytes. I can see if bytes are wrong. I can't see if characters are wrong.
– gnasher729
Feb 4 '16 at 12:37
add a comment |
2 Answers
2
active
oldest
votes
I experienced the same issue, but it was because my initial URL was not correct.
The response needs to be checked before you parse the JSON. It could be telling you that it wasn't found.
At that point the data actually can contain a 404 HTML page.
I use these methods to debug this, and simpler methods to process the web request:
// Asynchronous fetch the JSON and call the block when done
NSURLSessionDataTask *downloadTask =
[[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:
^(NSData *data, NSURLResponse *response, NSError *error)
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
if ([httpResponse statusCode]!=200)
{
// log [response description]
// log [NSString stringWithUTF8String:[data bytes]]
return;
}
NSDictionary* jsonDic =
[NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingAllowFragments
error:&error];
if (!jsonDic)
{
return;
}
// process the JSON
}];
[downloadTask resume];
add a comment |
Your JSON has white space before the data:
[{"id":"37",
Check your server.
The issue was mis-use of theNSURLConnectionDelegateprotocol.
– Droppy
Jul 12 '16 at 8:27
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24801883%2finvalid-value-around-character-0-nsjsonserialization%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I experienced the same issue, but it was because my initial URL was not correct.
The response needs to be checked before you parse the JSON. It could be telling you that it wasn't found.
At that point the data actually can contain a 404 HTML page.
I use these methods to debug this, and simpler methods to process the web request:
// Asynchronous fetch the JSON and call the block when done
NSURLSessionDataTask *downloadTask =
[[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:
^(NSData *data, NSURLResponse *response, NSError *error)
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
if ([httpResponse statusCode]!=200)
{
// log [response description]
// log [NSString stringWithUTF8String:[data bytes]]
return;
}
NSDictionary* jsonDic =
[NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingAllowFragments
error:&error];
if (!jsonDic)
{
return;
}
// process the JSON
}];
[downloadTask resume];
add a comment |
I experienced the same issue, but it was because my initial URL was not correct.
The response needs to be checked before you parse the JSON. It could be telling you that it wasn't found.
At that point the data actually can contain a 404 HTML page.
I use these methods to debug this, and simpler methods to process the web request:
// Asynchronous fetch the JSON and call the block when done
NSURLSessionDataTask *downloadTask =
[[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:
^(NSData *data, NSURLResponse *response, NSError *error)
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
if ([httpResponse statusCode]!=200)
{
// log [response description]
// log [NSString stringWithUTF8String:[data bytes]]
return;
}
NSDictionary* jsonDic =
[NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingAllowFragments
error:&error];
if (!jsonDic)
{
return;
}
// process the JSON
}];
[downloadTask resume];
add a comment |
I experienced the same issue, but it was because my initial URL was not correct.
The response needs to be checked before you parse the JSON. It could be telling you that it wasn't found.
At that point the data actually can contain a 404 HTML page.
I use these methods to debug this, and simpler methods to process the web request:
// Asynchronous fetch the JSON and call the block when done
NSURLSessionDataTask *downloadTask =
[[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:
^(NSData *data, NSURLResponse *response, NSError *error)
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
if ([httpResponse statusCode]!=200)
{
// log [response description]
// log [NSString stringWithUTF8String:[data bytes]]
return;
}
NSDictionary* jsonDic =
[NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingAllowFragments
error:&error];
if (!jsonDic)
{
return;
}
// process the JSON
}];
[downloadTask resume];
I experienced the same issue, but it was because my initial URL was not correct.
The response needs to be checked before you parse the JSON. It could be telling you that it wasn't found.
At that point the data actually can contain a 404 HTML page.
I use these methods to debug this, and simpler methods to process the web request:
// Asynchronous fetch the JSON and call the block when done
NSURLSessionDataTask *downloadTask =
[[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:
^(NSData *data, NSURLResponse *response, NSError *error)
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
if ([httpResponse statusCode]!=200)
{
// log [response description]
// log [NSString stringWithUTF8String:[data bytes]]
return;
}
NSDictionary* jsonDic =
[NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingAllowFragments
error:&error];
if (!jsonDic)
{
return;
}
// process the JSON
}];
[downloadTask resume];
answered Feb 8 '15 at 11:13
GilesDMiddletonGilesDMiddleton
1,7131521
1,7131521
add a comment |
add a comment |
Your JSON has white space before the data:
[{"id":"37",
Check your server.
The issue was mis-use of theNSURLConnectionDelegateprotocol.
– Droppy
Jul 12 '16 at 8:27
add a comment |
Your JSON has white space before the data:
[{"id":"37",
Check your server.
The issue was mis-use of theNSURLConnectionDelegateprotocol.
– Droppy
Jul 12 '16 at 8:27
add a comment |
Your JSON has white space before the data:
[{"id":"37",
Check your server.
Your JSON has white space before the data:
[{"id":"37",
Check your server.
answered May 27 '15 at 3:28
elliotrockelliotrock
1,58131625
1,58131625
The issue was mis-use of theNSURLConnectionDelegateprotocol.
– Droppy
Jul 12 '16 at 8:27
add a comment |
The issue was mis-use of theNSURLConnectionDelegateprotocol.
– Droppy
Jul 12 '16 at 8:27
The issue was mis-use of the
NSURLConnectionDelegate protocol.– Droppy
Jul 12 '16 at 8:27
The issue was mis-use of the
NSURLConnectionDelegate protocol.– Droppy
Jul 12 '16 at 8:27
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24801883%2finvalid-value-around-character-0-nsjsonserialization%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Looks like some rubbish data before the opening '['. NSLog the NSData that you received and show us the first dozen bytes.
– gnasher729
Jul 17 '14 at 11:11
[{"id":"37","id_estado":"1","id_categoria":...
– ƒernando Valle
Jul 17 '14 at 11:14
4
Why are you parsing the data in
didReceiveData:? Data is not downloaded completely there, you have to append the data there. Parse the data inconnectionDidFinishLoading:delegate method– Himanshu Joshi
Jul 17 '14 at 11:42
I love u man, I wasted my morning for this stupid error :D
– ƒernando Valle
Jul 17 '14 at 11:48
@ƒernandoValle: What you logged was characters. Not bytes. I can see if bytes are wrong. I can't see if characters are wrong.
– gnasher729
Feb 4 '16 at 12:37