0

私のPHPスクリプト:

$result = mysql_query('Select * FROM _events');
$rows = array();
  while($r = mysql_fetch_assoc($result)) 
     {
     $rows['results'][] = $r;
     }

print json_encode($rows);

結果:

{"results":[{"id":"1","title":"Night Run","url":"http:\/\/www.orf.at","date":"01.10.2013"},
{"id":"2","title":"Silvester","url":"http:\/\/www.sms.at","date":"31.12.2013"}]}

私の問題は、Xcode iOS アプリがデータを受信できないことですか?

  - (void)viewDidLoad

 {

[super viewDidLoad];
self.title = @"Ergebnisse";


dispatch_async(kBgQueue, ^{

    NSData* data = [NSData dataWithContentsOfURL:

                    kjsonURL];

    [self performSelectorOnMainThread:@selector(fetchedData:)

                           withObject:data waitUntilDone:YES];

});

 }


 - (void)fetchedData:(NSData *)responseData {

NSError* error;

NSDictionary* json = [NSJSONSerialization

                      JSONObjectWithData:responseData

                      options:kNilOptions

                      error:&error];

ergebnisse = [json objectForKey:@"results"];

[self.tableView reloadData];

}

何か問題はありませんか?誰か助けてくれませんか?Xcodeエラーには次のように書かれています:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil' * First throw call stack: (0x30780ed3 0x3a7a96c7 0x30780e15 0x310ea267 0xe8f61 0x311464cb 0x3074bf27 0x3074b3ef 0x30749bdf 0x306b4541 0x306b4323 0x35148343 0x32ccd7b5 0xea015 0x3acbeab7) libc++abi.dylib: terminating withタイプ NSException のキャッチされない例外 (lldb)

???

4

0 に答える 0