Reputation: 2484
I just launched the app and I have an issue with iPhone 5 and 5c and iOS 10.3.3 (only).
I really don't understand the problem, even with the Crashlytics report:
The problem seems to come from this line:
@objc UserProfilViewController.collectionView(UICollectionView, layout : UICollectionViewLayout, sizeForItemAtIndexPath : IndexPath) -> CGSize
This is my code:
// Cell size
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize {
let size: CGSize
if cellIsNull == false {
size = CGSize(width: self.view.frame.size.width * 0.47, height: self.view.frame.size.width * 0.47)
} else {
size = CGSize(width: self.view.frame.size.width, height: self.view.frame.size.width * 0.47)
}
return size
}
If I run the app on the simulator (with an iPhone 5), the app is not crashing, and I don't have iPhone 5 so I don't test it.
Upvotes: 3
Views: 1670
Reputation: 14123
Call it a coincidence. I asked a similar question few hours back. Not same but similar.
The solution is to put @objc
in front of function definition. So function should be like :
@objc func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize {
....
}
The main thing to notice is that the crash is random. I myself haven't received this yet. There might be a possibility that it depends on the iOS or indirectly, Swift version.
Upvotes: 3