我试图从这个JSON中抓取artistId
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<table>
<tr>
<td>ClientName</td>
<td>ItemName</td>
<td>Quantity</td>
<td>12</td>
<td>34</td>
</tr>
<tr>
<td>ClientName</td>
<td>ItemName</td>
<td>Quantity</td>
<td>56</td>
<td>78</td>
</tr>
<tr>
<td>ClientName</td>
<td>ItemName</td>
<td>Quantity</td>
<td>90</td>
<td>12</td>
</tr>
<tr>
<td colspan="3">Totals</td>
<td id="subtotal"></td>
<td id="total">12</td>
</tr>
</table>
创建播客对象时。但是当我尝试将此变量显示为字符串时,它返回null。我该如何解决这个问题?
这是我尝试访问artistID的地方
{
"wrapperType": "track",
"kind": "podcast",
"artistId": 125443881,
"collectionId": 523121474,
"trackId": 523121474,
字符串使&#34; podcastID&#34; (null)在所有情况下。
这是iTunes响应,我在其中分配了艺术家ID
NSNumber *podcastID = episode.podcast.artistID;
NSString *episodeNumber = [episode.title stringByReplacingOccurrencesOfString:@" " withString:@"-"];
NSString *deeplinkURL = [NSString stringWithFormat: @"podcast://%@/%@",podcastID, episodeNumber];
答案 0 :(得分:0)
尝试使用NSNumber:
self.artistId = [(NSNumber *)[response valueForKey:@"artistId"] integerValue];