了解访问私有方法如何不抛出错误

Understanding how accessing private method is not throwing error

在 jitsi Meet 他们有一个方法没有在接口中声明

https://github.com/jitsi/jitsi-meet/blob/master/ios/sdk/src/JitsiMeet.m#L217

- (RCTBridge *)getReactBridge {
    return _bridgeWrapper.bridge;
}

在其他文件中,他们是这样访问的,但这不是throwing/complaining任何错误

https://github.com/jitsi/jitsi-meet/blob/master/ios/sdk/src/JitsiMeetView.m#L200

 RCTBridge *bridge = [[JitsiMeet sharedInstance] getReactBridge];
        rootView
            = [[RNRootView alloc] initWithBridge:bridge
                                      moduleName:@"App"
                               initialProperties:props];
        rootView.backgroundColor = self.backgroundColor;

        // Add rootView as a subview which completely covers this one.
        [rootView setFrame:[self bounds]];
        rootView.autoresizingMask
            = UIViewAutoresizingFlexibleWidth
                | UIViewAutoresizingFlexibleHeight;
        [self addSubview:rootView];

不应该xcode在这里抛出错误吗?因为这没有在接口中声明?

它似乎在 JitsiMeet+Private.h 中声明 - 这看起来像一个 Objective-C 模式,您希望在其中拥有类似 'protected' 方法的东西,您可以通过制作一个向友好 类.

公开方法的头文件