无法在 IOS 上构建项目。
错误:
Cannot find type 'RCTEventDispatcher' in scope
React-native v0.73.6 + react-native-video ^6.5.0
import AVFoundation
import AVKit
import Foundation
#if USE_GOOGLE_IMA
import GoogleInteractiveMediaAds
#endif
import React
// MARK: - RCTVideo
class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverHandler {
private var _player: AVPlayer?
private var _playerItem: AVPlayerItem?
private var _source: VideoSource?
private var _playerLayer: AVPlayerLayer?
private var _chapters: [Chapter]?
private var _playerViewController: RCTVideoPlayerViewController?
private var _videoURL: NSURL?
private var _localSourceEncryptionKeyScheme: String?
/* Required to publish events */
private var _eventDispatcher: RCTEventDispatcher?
private var _videoLoadStarted = false
init(eventDispatcher: RCTEventDispatcher!) {
super.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
ReactNativeVideoManager.shared.registerView(newInstance: self)
#if USE_GOOGLE_IMA
_imaAdsManager = RCTIMAAdsManager(video: self, pipEnabled: isPipEnabled)
#endif
_eventDispatcher = eventDispatcher
#if os(iOS)
if _pictureInPictureEnabled {
initPictureinPicture()
_playerViewController?.allowsPictureInPicturePlayback = true
} else {
_playerViewController?.allowsPictureInPicturePlayback = false
}
#endif
pods 重新安装不起作用我已经用谷歌搜索过,下一期中描述的所有方法都不起作用:https://github.com/TheWidlarzGroup/react-native-video/issues/3004
https://github.com/TheWidlarzGroup/react-native-video/issues/3622
https://github.com/TheWidlarzGroup/react-native-video/issues/3152 错误:需要一个类型 - eventDispatcher:(nonnull RCTEventDispatcher *)eventDispatcher;并且 iOS 构建期间出现“未定义符号”错误
为我工作:
将react-native版本从“0.73.6”更新为“0.75.3”
在 ios 文件夹中运行命令“pod update hermes-engine --no-repo-update”