【发布时间】:2014-04-22 10:53:51
【问题描述】:
我正在使用 parse.com 获取如下所示的数据。我已经使用 sqlite manager 创建了数据库。
- (IBAction)button:(id)sender {
PFQuery *postQuery = [PFQuery queryWithClassName:@"movie"];
//movie is the class name in the parse.com in that two columns store the data
[postQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
//Save results and update the table
self.postArray = objects;
NSLog(@"array....%@",self.postArray);
// [spinner startAnimating];
[self.myTable reloadData];
}
}];
}
- (void)getTheData:(id)sender {
//it is sqlite query class
model=[[DataModel alloc]init];
//here insertQuery method to send the columns class object(buk).
[model insertInformIntoDB:buk];
PFObject *post = [self.postArray objectAtIndex:indexPath.row];
NSLog(@"posttttt......%@",post);
//here parse.com column name to send the data into sqlite Columns
buk.name=[post objectForKey:@"name"];
buk.Hero=[post objectForKey:@"Hero"];
}
我得到这样的输出:
//这是整个电影类
array....(
"<movie:EHx3UonJmw:(null)> {\n Hero = Mahesh;\n name = pokiri;\n num = 222;\n}",
"<movie:zekgTzIsLs:(null)> {\n Hero = pawan;\n name = jhoni;\n num = 412;\n}",
"<movie:0z3ZkI4lvB:(null)> {\n Hero = Prabhas;\n name = darling;\n num = 312;\n}"
)
posttttt......<movie:EHx3UonJmw:(null)> {
Hero = Mahesh;
name = pokiri;
num = 222;
}
错误:-
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSMutableString stringWithUTF8String:]: NULL cString'
但是这里在 buk.name 和 Hero 中得到空值....
【问题讨论】:
-
NSLog(@"posttttt......%@",post);记录了什么? -
PFObject *post = [self.postArray objectAtIndex:indexPath.row]; //这里先从parse.com获取数据我们在发送到post后进入postArray
-
你的问题现在变得一团糟。你有例外,你也有 nil 值?你的问题是什么异常或零值?我认为应该先例外
-
在这里查看link 帮助你!..如果有帮助,别忘了投票!
-
非常感谢你对我非常有用 walle84
标签: ios sqlite parse-platform objective-c-blocks