Ios CoreAnimation:[EAGLContext renderbufferStorage:fromDrawable:]是从非主线程调用的

Ios CoreAnimation:[EAGLContext renderbufferStorage:fromDrawable:]是从非主线程调用的,ios,objective-c,uiwebview,Ios,Objective C,Uiwebview,在我的音乐应用程序中,当我尝试显示广告时(我使用的是Triton SDK),有时应用程序会崩溃并出现以下错误: CoreAnimation:[EAGLContext renderbufferStorage:fromDrawable:]是在隐式事务中从非主线程调用的!请注意,如果没有明确的CATTransaction或调用[CATTransaction flush],这可能是不安全的。 我的广告包含横幅和MP3音频,请任何人帮助我 以下是连续调用的流式歌曲代码:- - (void) configu

在我的音乐应用程序中,当我尝试显示广告时(我使用的是Triton SDK),有时应用程序会崩溃并出现以下错误:

CoreAnimation:[EAGLContext renderbufferStorage:fromDrawable:]是在隐式事务中从非主线程调用的!请注意,如果没有明确的CATTransaction或调用[CATTransaction flush],这可能是不安全的。

我的广告包含横幅和MP3音频,请任何人帮助我

以下是连续调用的流式歌曲代码:-

- (void) configureAudioStremaing {

if ([Singletone sharedSingletone].playMusic == NO) {



    NSError *setCategoryError = nil;

    NSError *activationError = nil;

    [[AVAudioSession sharedInstance] setActive:YES withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:&activationError];



    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:&setCategoryError];

    [app beginReceivingRemoteControlEvents];



}



else {



    NSError *setCategoryError = nil;

    NSError *activationError = nil;


    [[AVAudioSession sharedInstance] setActive:NO withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:&activationError];

    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:&setCategoryError];

        [app beginReceivingRemoteControlEvents];


}
当Ad仅显示在主线程中调用的所有函数时,调用了以下函数,但我有时会遇到崩溃问题:-

//for banner view



- (void) showAdbanner {



[Singletone sharedSingletone].impressionUrlCalled = NO;

[[Singletone sharedSingletone].bannerView removeFromSuperview];



BOOL adFrameFound = NO;



for (int i = 0; i < [[Singletone sharedSingletone].ad.companionBanners count]; i++) {



    TDCompanionBanner *banner = [[Singletone sharedSingletone].ad.companionBanners objectAtIndex:i];



    if (banner.width == 300 && banner.height == 250) {

        [Singletone sharedSingletone].bannerView = [[TDBannerView alloc] initWithWidth:banner.width andHeight:banner.height];

        adFrameFound = YES;

        break;

    }

}



if (adFrameFound == NO) {

    [Singletone sharedSingletone].bannerView = [[TDBannerView alloc] initWithWidth:300 andHeight:250];

}



if (songProgressView!=nil) {

    [Singletone sharedSingletone].bannerView.translatesAutoresizingMaskIntoConstraints = NO;

    [Singletone sharedSingletone].bannerView.backgroundColor = [blackColor colorWithAlphaComponent:0.5];

    [self.view addSubview:[Singletone sharedSingletone].bannerView];



    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:[Singletone sharedSingletone].bannerView

                                                          attribute:NSLayoutAttributeTop

                                                          relatedBy:NSLayoutRelationEqual

                                                          toItem:songProgressView

                                                          attribute:NSLayoutAttributeBottom

                                                         multiplier:1.0 constant:0.0]];



    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:[Singletone sharedSingletone].bannerView

                                                          attribute:NSLayoutAttributeCenterX

                                                          relatedBy:NSLayoutRelationEqual

                                                             toItem:self.view

                                                          attribute:NSLayoutAttributeCenterX

                                                         multiplier:1.0 constant:0.0]];

    [[Singletone sharedSingletone].bannerView presentAd:[Singletone sharedSingletone].ad];

    }
//用于标题视图
-(无效)showAdbanner{
[Singletone sharedSingletone].impressionUrlCalled=否;
[[Singletone sharedSingletone].bannerView从SuperView移除];
BOOL adFrameFound=否;
对于(int i=0;i<[[Singletone sharedSingletone].ad.companionBanner计数];i++){
TDCompanionBanner*banner=[[Singletone sharedSingletone].ad.companionBanner对象索引:i];
如果(banner.width==300&&banner.height==250){
[Singletone sharedSingletone].bannerView=[[TDBannerView alloc]initWithWidth:banner.width和height:banner.height];
adFrameFound=是;
打破
}
}
如果(adFrameFound==否){
[Singletone sharedSingletone].bannerView=[TDBannerView alloc]初始值,宽度:300,高度:250];
}
如果(songProgressView!=nil){
[Singletone sharedSingletone].bannerView.TranslatesAutoResizingMacSkinToConstraints=否;
[Singletone sharedSingletone].bannerView.backgroundColor=[blackColor WithAlphaComponent:0.5];
[self.view addSubview:[Singletone sharedSingletone].bannerView];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:[Singletone sharedSingletone]。bannerView
属性:NSLAYUTATTRIBUTETOP
关系人:NSLayoutRelationEqual
toItem:songProgressView
属性:NSLAYUTATTRIBUTEBOTTOM
乘数:1.0常数:0.0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:[Singletone sharedSingletone]。bannerView
属性:nsLayoutAttributeCenter
关系人:NSLayoutRelationEqual
toItem:self.view
属性:nsLayoutAttributeCenter
乘数:1.0常数:0.0]];
[[Singletone sharedSingletone].bannerView presentAd:[Singletone sharedSingletone].ad];
}
}

我从crashlystics收到了这份报告:

试试这个

dispatch_async(dispatch_get_main_queue(), ^{

// put your code here to be call
});

请添加代码我已经在required字段中使用了此dispatch\u async,您能告诉我我需要在哪个函数中使用它吗?我已经更新了我的问题,请再次检查。因此检查此presentAd函数调用背后的代码必须有一些转换。谢谢您的回复。是的,我已在中调用ShowAdbanner主线程,以及我如何检查当前广告中的转换抱歉,我不明白,请解释我通过简单的右键单击Presentadn跳转到其定义Presentadn中不存在转换请检查ss()并检查从Crashlystics收到的此ss()