Hi Yavuz,
the "problem" is that the 'null' (for telephone on the first object) is,
in
Cocoa/ObjC mapped to NSNull. However, NSNull is, unfortunately, not a
"valid" PList object/type.
A work around, on your server, would be to do something like: "telephone"
=> "NULL", or simply exclude all keys where values are "NULL"...
:-/
There are ways how we could fix it on the library:
* exclude every key, where value is NSNull (which makes the value 'nil'
(not NSNull)
* see if new 'store' could be written, that simply
uses NSJSONSerialization, to store JSON on the "filesystem"
I will create a JIRA ticket for this issue.
Thanks for the feedback.
-M
On Wed, Jun 12, 2013 at 7:52 PM, Yavuz Selim YILMAZ <yavuzsel(a)buffalo.edu>wrote:
here is my response object from log:
({
id = 1;
mail = "yavuzsel(a)buffalo.edu";
name = "yavuz";
telephone = "<null>";
},
{
id = 2;
mail = "yavuzsel(a)buffalo.edu";
name = "yavuzsel";
telephone = "001234";
}
)
thanks,
---
Yavuz Selim Yilmaz
SUNY at Buffalo
Computer Science and Engineering
PhD Candidate
On Jun 12, 2013, at 1:49 PM, Matthias Wessendorf <matzew(a)apache.org>
wrote:
can u NSLog the 'responseObject'?
Is that a NSDictionary or NSArray?
On Wednesday, June 12, 2013, Yavuz Selim YILMAZ wrote:
> Hi all,
>
> I am getting error while saving my response object to my store. Here are
> my codes:
>
>
> AGPipeline *pipeline = [AGPipeline pipelineWithBaseURL:[NSURL
> URLWithString:@"localhost"]];
>
> id<AGPipe> dataPipe = [pipeline pipe:^(id<AGPipeConfig> config) {
> [config setName:@"persons"];
> [config setEndpoint:@"get_persons.php"];
> }];
>
> AGDataManager *dm = [AGDataManager manager];
>
> id<AGStore> dataStore = [dm store:^(id<AGStoreConfig> config) {
> [config setName:@"persons"];
> [config setType:@"PLIST"];
> }];
>
> [dataPipe read:^(id responseObject) {
> NSError *error;
> if (![dataStore save:responseObject error:&error])
> NSLog(@"Save: An error occured during save! \n%@", error);
>
> } failure:^(NSError *error) {
> NSLog(@"An error has occured during read! \n%@", error);
> }];
>
>
> And I am getting this log output:
>
> Save: An error occured during save!
> Error Domain=org.aerogear.stores.save Code=0 "error on save"
> UserInfo=0x727a6e0 {NSLocalizedDescription=error on save}
>
>
> here is my "get_persons.php"
>
> <?php
> $result_array = array(array(
> "id" => 1,
> "name" => "yavuz",
> "mail" => "yavuzsel(a)buffalo.edu",
> "telephone" => NULL
> ),
> array(
> "id" => 2,
> "name" => "yavuzsel",
> "mail" => "yavuzsel(a)buffalo.edu",
> "telephone" => "001234"
> ));
> header('HTTP/1.1 200 OK');
> header('content-type: application/json');
> echo json_encode($result_array);
> ?>
>
>
> Any help or direction is appreciated.
>
> Cheers,
>
> ---
> Yavuz Selim Yilmaz
> SUNY at Buffalo
> Computer Science and Engineering
> PhD Candidate
>
>
--
Matthias Wessendorf
blog:
http://matthiaswessendorf.wordpress.com/
sessions:
http://www.slideshare.net/mwessendorf
twitter:
http://twitter.com/mwessendorf
_______________________________________________
aerogear-dev mailing list
aerogear-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev
_______________________________________________
aerogear-dev mailing list
aerogear-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev
--
Matthias Wessendorf
blog:
http://matthiaswessendorf.wordpress.com/
sessions:
http://www.slideshare.net/mwessendorf
twitter:
http://twitter.com/mwessendorf