我在这头上挠头。
我不断收到以下错误消息:
'NSInvalidArgumentException', reason: '-[_NSFaultingMutableSet objectAtIndex:]: unrecognized selector sent to instance
0x7ff3ec6b4590'
当我尝试从收藏夹视图中访问Photo Core Data模型时。
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
var cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! PinViewCollectionViewCell
println(selectedPin!.attachedPhotos.count) // Returns 3
println(selectedPin!.attachedPhotos[indexPath.row])
//^^Returns NSInvalidArgumentException', reason: '-[_NSFaultingMutableSet objectAtIndex:]:
//unrecognized selector sent to instance 0x7ff3ec6b4590'
return cell
有什么想法可以访问附件的个人照片吗?
最佳答案
尝试这个;
println((selectedPin!.attachedPhotos.allObjects as! NSArray)[indexPath.row]);