1、錯(cuò)誤信息:Multiple methods named 'numberOfItemsInSection:' found with mismatched result, parameter type or attributes
報(bào)錯(cuò)的代碼:
NSInteger numberOfBeforeSection = [_update[@"oldModel"] numberOfItemsInSection:updateItem.indexPathBeforeUpdate.section];
修改的代碼:
NSInteger numberOfBeforeSection = [(UICollectionView *)_update[@"oldModel"] numberOfItemsInSection:updateItem.indexPathBeforeUpdate.section];
2、錯(cuò)誤信息:'playbackState' is only available in iOS 13.0 or newer
解決代碼:
if #available(iOS 13.0, *) {
MPNowPlayingInfoCenter.default().playbackState = .playing
} else {
// Fallback on earlier versions
}
官方的API:
@available(iOS 5.0, *)
open class MPNowPlayingInfoCenter : NSObject {
/// Returns the default now playing info center.
/// The default center holds now playing info about the current application.
open class func `default`() -> MPNowPlayingInfoCenter
/// The current now playing info for the center.
/// Setting the info to nil will clear it.
open var nowPlayingInfo: [String : Any]?
/// The current playback state of the app.
/// This only applies on macOS, where playback state cannot be determined by
/// the application's audio session. This property must be set every time
/// the app begins or halts playback, otherwise remote control functionality may
/// not work as expected.
@available(iOS 13.0, *)
open var playbackState: MPNowPlayingPlaybackState
}
3颜矿、問(wèn)題:iOS13上朗涩,viewController在present出來(lái)后愿待,沒(méi)有全屏糠惫,頂部會(huì)留白实撒。
解決方式:
viewController.modalPresentationStyle = UIModalTransitionStyle.overFullScreen