同様の質問がありますが、私に合った解決策が見つかりませんでした。 私はリンクからのすべてのデータをJSON
としていますが、そのデータをuitableviewにどのように表示できるのか理解できません。ホームページに掲載される予定です。それはtitle
,info
です。今のところ、ホームページにはtitle
とinfo
が必要です。uiviewTable ios(目的c)でJSONデータを渡す
NSURL *url = [NSURL URLWithString:@"http://mantis.vu.edu.pk/fundme/public/api/v1/ideas"];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
AFJSONRequestOperation *jsonOperation = [AFJSONRequestOperation JSONRequestOperationWithRequest:urlRequest success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON)
{
NSDictionary *responseDict = (NSDictionary *)JSON;
ideasArrayList = [[NSMutableArray alloc] init];
for (NSDictionary *innerObject in [responseDict objectForKey:@"data"])
{
[ideasArrayList addObject:innerObject];
if (ideasArrayList.count > 0) {
NSDictionary *userObject = [ideasArrayList objectAtIndex:0];
NSLog(@"Object and first index of array is %@",userObject);
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oops something went wrong."
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alertView show];
}];
[jsonOperation start];
私はAFNetworking
ライブラリを使用しています。
「innerObject」 –
をプレビューすると、問題の 'userObject'または' innerObject'の値を追加できます。 'cellforrowatindexpath'メソッドを追加してみてください! – Lion
NSnotificationCenterを使用して、必要に応じてデータを表示して解析する場所に辞書データ全体を渡します。 –