简体   繁体   English

为什么我不能在 GCD 中访问这个对象

[英]Why can't i access this object in GCD

Server* mImpl;


void receiveImage()
{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        dispatch_async(dispatch_get_main_queue(), ^{
            [mImpl function];
        });
        return;
}

I have this peice of code above.我上面有这段代码。 For some reason, whenever this code is wrapped in a GCD as such, I get an error saying an -[UIWindowLayer function]: unrecognized selector sent to instance出于某种原因,每当将此代码包装在 GCD 中时,我都会收到一条错误消息,指出-[UIWindowLayer function]: unrecognized selector sent to instance

The error message gives you your answer.错误消息为您提供了答案。

The problem is that " mImpl is defined as a UIWindowLayer and there is no such thing as " function " on a UIWindowLayer object.问题是“ mImpl被定义为 UIWindowLayer 并且在 UIWindowLayer 对象上没有“ function ”这样的东西。

And in fact, I don't even thing UIWindowLayer is a public Apple / iOS framework thing.事实上,我什至不认为 UIWindowLayer 是一个公共的 Apple / iOS 框架。 You probably need to figure out why your " Server " is being declared in that function to be a UIWindowLayer.您可能需要弄清楚为什么在该函数中将您的“ Server ”声明为 UIWindowLayer。 Did you define or set it up properly before " receiveImage " gets called?在调用“ receiveImage ”之前,您是否正确定义或设置了它?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM