Episodes for a podcasts shows are split into random collections when using MPMediaQuery

Originator:nicole
Number:rdar://46601303 Date Originated:10-Dec-2018
Status:Open Resolved:No
Product:iOS + SDK Product Version:iOS 12
Classification: Reproducible:Sometimes
 
Area:
Media Player Framework

Summary:
Sometimes episodes for a podcasts shows are split into random collections when using `MPMediaQuery` when the episodes are downloaded on different days. If all episodes for a show are deleted then dowloaded all at the same time, the episodes are all returned in one collection. This does not happen for all podcast shows but it will show up half of the time when a new episode is downloaded for a show. There does not seem to be any reason for the episodes to be separated into different collections (the episodes are not grouped by show season, release data, or date downloaded).
  
Steps to Reproduce:
1. Download a podcast episode for a show.
2. Wait a day and download another episode for the same show as in step #1.
2. Query for all podcasts in the library.
```
    class func allPodcasts() -> [MPMediaItemCollection] {
        let query = MPMediaQuery.podcasts()
        query.groupingType = .podcastTitle
        return query.collections ?? []
    }
```

Expected Results:
The episodes downloaded in steps 1 and 2 will be grouped into one `[MPMediaItemCollection]`.

Actual Results:
Sometimes the episodes downloaded in steps 1 and 2 will be grouped into two or more (depending on the number of episodes downloaded for the show) `[MPMediaItemCollection]`s even though they share the same `podcastTitle`. 

Version/Build:
iOS 12.0, 12.1

Configuration:
iPhone XS Max and iOS 12.0, iPhone 6 and iOS 12.1

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!