현재 장치에있는 노래 만 포함 된 UITableView를 표시하려고합니다.로컬 항목 만 반환하는 MPMediaQuery
내가 모든 항목을 조회하면 (구매 한 적이 있지만 다운로드하지 않은 항목을 포함하여) 분명히 모든 항목을 가져옵니다. 여기 내가
[song valueForProperty:MPMediaItemPropertyIsCloudItem]
을 포함에 대해 몇 가지를 읽고하지만 위에서 설명한대로 동작하지 않습니다 코드
@property (strong, nonatomic) NSMutableArray *songsList;
- (void)viewDidLoad
{
[super viewDidLoad];
self.tableView.delegate = self;
self.tableView.dataSource = self;
MPMediaQuery *everything = [[MPMediaQuery alloc] init];
NSArray *itemsFromGenericQuery = [everything items];
self.songsList = [NSMutableArray arrayWithArray:itemsFromGenericQuery];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.songsList.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"TableCellID";
TableCellTitle *tablecell = (TableCellTitle *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
MPMediaItem *song = [self.songsList objectAtIndex:indexPath.row];
NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle];
tablecell.cellSongname.text = songTitle;
return tablecell;
}
의 (일부)입니다. 제안 사항이 있으십니까?
나 ' ve도 비슷한 문제가있었습니다. 애플의 뮤직 앱은 인터넷이 다운되었을 때 장치에없는 노래를 모두 걸러 낸다. 나는 MPMediaItemPropertyIsCloudItem과 관련이 없다고 생각한다. 이 속성은 클라우드에서 수동으로 다운로드 한 노래 만 가져 오는 반면, 음악 앱은 수동으로 다운로드했는지 아니면 사용자가 방금 한 번 들었는지에 관계없이 캐시에 다운로드 된 노래를 감지 할 수 있습니다 . 나는 이것에 대한 해결책을 찾고 싶다. – sooper
아니면 단순히 클라우드에서 다운로드 한 노래를 검색하려고합니까? – sooper
우리는 같은 것을 찾고있는 것처럼 들리네 ...;) – ASCJU