xcode11更新报错问题整理

1、错误信息:Multiple methods named 'numberOfItemsInSection:' found with mismatched result, parameter type or attributes
报错的代码:

 NSInteger numberOfBeforeSection = [_update[@"oldModel"] numberOfItemsInSection:updateItem.indexPathBeforeUpdate.section];

修改的代码:

NSInteger numberOfBeforeSection = [(UICollectionView *)_update[@"oldModel"] numberOfItemsInSection:updateItem.indexPathBeforeUpdate.section];

2、错误信息:'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、问题:iOS13上,viewController在present出来后,没有全屏,顶部会留白。
解决方式:

viewController.modalPresentationStyle = UIModalTransitionStyle.overFullScreen
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容