받은 JSon에서 작동하도록 UIImage를 가져 오는 데 문제가 있습니다. 여기의 내 JSON 여기JSON에서 UIImage 가져 오기
[
{
node_title: "Fumi",
node_uid: "11",
users_node_name: "pae",
nid: "7",
Body: "<p>This is Fumi Restaurant</p> ",
Enterprise Address: "99/9",
Enterprise Email: "[email protected]",
Enterprise Tel: "08111111",
Enterprise Logo: "<img typeof="foaf:Image" src="http://localhost/drupal/sites/default/files/Fumi.jpg" width="300" height="300" alt="" />"
},
{
node_title: "Fuji",
node_uid: "8",
users_node_name: "testent",
nid: "1",
Body: "<p>Fuji</p> ",
Enterprise Address: "Somwhere it belong",
Enterprise Email: "[email protected]",
Enterprise Tel: "02-999-9999",
Enterprise Logo: "<img typeof="foaf:Image" src="http://localhost/drupal/sites/default/files/Fuji.png" width="320" height="320" alt="" />"
}
]
내 코드를 살펴 보자 : 내가받은 모든 JSON을 얻을이의 ViewController에 그들을 보여줄 수 있어요. 그러나 [self.detail valueForKey : @ "Enterprise Logo"]는 JSON의 내용으로 인해 작동하지 않는 것 같습니다.
BTW, self.detail은 준비 작업을 수행하여 이전 UITableViewController에서 전달한 Json 객체입니다.
- (void)viewDidLoad
{
[super viewDidLoad];
self.EnterPriseName.text = [self.detail valueForKey:@"node_title"];
self.EnterPriseTel.text = [self.detail valueForKey:@"users_node_name"];
self.EnterPriseBody.text = [self.detail valueForKey:@"Body"];
self.EnterPriseEmail.text = [self.detail valueForKey:@"nid"];
[self.picLogo setImageWithURL:[NSURL URLWithString:[self.detail valueForKey:@"Enterprise Logo"]]];
}
잘 작동하는이 방법을 사용해보세요.하지만 Enterprise 로고의 콘텐츠에는 해당 img의 URL 만 포함되어야합니다. 가능한 한 동적 인 일을하려고하므로 고정 응답을 기대하지 않습니다. 이 문제를 해결할 수있는 방법이 있습니까?
[self.picLogo setImageWithURL:[NSURL URLWithString:@"http://localhost/drupal/sites/default/files/Fumi.jpg"]];
이는 합법적 인 JSON이 아닙니다. 그것은 구문 분석하지 않습니다. –
@HotLicks 어떻게 합법적으로 만들 수 있습니까? – user3027109
다른 쪽에서 합법적 인 JSON을 생성하도록하십시오. –