“数据格式化程序暂时不可用......”错误 [英] "Data Formatters temporarily unavailable..." Error

查看:110
本文介绍了“数据格式化程序暂时不可用......”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

程序接收信号:0。数据格式化程序暂时不可用

我在XiB上接受200个OBShapedButtons并设置那边的背景图片。
之后,我将拍摄特定OBShapedButton的图像,并将图像着色并再次将其设置为OBShapedButton的背景。

I am taking above 200 OBShapedButtons on XiB and setting up the background images over there. After that I am taking the image of that particular OBShapedButton and coloring the image and setting it back again as the background of that OBShapedButton.

-(void)onTick:(NSTimer *)timer {
    //Database
    UIImage *setColor=[[UIImage alloc] init];
    for (int i=0; i<[dataArray count]; i++)
    { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
        currentLevelMaleValue =[[[dataArray objectAtIndex:i] objectForKey:@"CurrentLevelMaleColor"] doubleValue];
        printf("Current val is %f",currentLevelMaleValue);
        for (OBShapedButton *obshapedCountryButtons in scrollBaseView.subviews) 
        {
            if (obshapedCountryButtons.tag==i+1) 
            {
                UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapButton:)];
                tap.numberOfTouchesRequired=1;
                tap.numberOfTapsRequired=1;
                [obshapedCountryButtons addGestureRecognizer:tap];
                [obshapedCountryButtons addTarget:self action:@selector(buttonTagTrap:) forControlEvents:UIControlEventTouchDown];
                //[obshapedCountryButtons addTarget:self action:@selector(tapButton:) forControlEvents:UIControlStateHighlighted];
                setColor=[obshapedCountryButtons imageForState:UIControlStateNormal];
                countryCode =[self getCountryColorCurrentLevel:currentLevelMaleValue];
                setColor =[setColor imageTintedWithColor:countryCode];
                [obshapedCountryButtons setImage:setColor forState:UIControlStateNormal];[pool release];
                //    [setColor release];
                //    [obshapedCountryButtons release];
                //    [tap release]; 
                //         
            }

            //  }
        }
    }
}

现在,我收到此错误[循环执行约40次后] -

Now,I am getting this error[After the loop has been executed around 40 times]-


收到信号:0。数据格式化程序暂时
不可用,将在'继续'后重试。 (加载
共享库时出现未知错误/Developer/usr/lib/libXcodeDebuggerSupport.dylib

Program received signal: "0". Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib

收到此警告 -


收到内存警告

Received memory warning

然后该应用程序是终止。

Then the app is getting terminated.

注意:

没有对象分配。

请帮我解决一些想法。我应该如何继续?

Please help me out with some of your ideas. How should I go ahead ?

推荐答案

UIImage *setColor=[[UIImage alloc] init];

是一个内存泄漏,因为你没有释放它。实际上分配是没有必要的,因为你正在为它分配一些其他值。同样点击也没有发布为你已经评论过该代码。

is a memory leak as you are not release it. Actually the allocation is not necessary as you are assigning some other values to it. Similarly tap is also not released as you have commented that code.

建议。尝试将此代码块放在 NSAutoreleasePool 中。

A suggestion for this. Try to put this block of code in NSAutoreleasePool.

修改:

-(void)onTick:(NSTimer *)timer {
    //Database
    UIImage *setColor;// =[[UIImage alloc] init];
    for (int i=0; i<[dataArray count]; i++)
    { 
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
        currentLevelMaleValue =[[[dataArray objectAtIndex:i] objectForKey:@"CurrentLevelMaleColor"] doubleValue];
        printf("Current val is %f",currentLevelMaleValue);
        for (OBShapedButton *obshapedCountryButtons in scrollBaseView.subviews) 
        {
            NSAutoreleasePool * pool1 = [[NSAutoreleasePool alloc] init];
            if (obshapedCountryButtons.tag==i+1) 
            {
                UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapButton:)];
                tap.numberOfTouchesRequired=1;
                tap.numberOfTapsRequired=1;
                [obshapedCountryButtons addGestureRecognizer:tap];
                [obshapedCountryButtons addTarget:self action:@selector(buttonTagTrap:) forControlEvents:UIControlEventTouchDown];
                //[obshapedCountryButtons addTarget:self action:@selector(tapButton:) forControlEvents:UIControlStateHighlighted];
                setColor=[obshapedCountryButtons imageForState:UIControlStateNormal];
                countryCode =[self getCountryColorCurrentLevel:currentLevelMaleValue];
                setColor =[setColor imageTintedWithColor:countryCode];
                [obshapedCountryButtons setImage:setColor forState:UIControlStateNormal];[pool release];
                //    [setColor release];
                //    [obshapedCountryButtons release];
                [tap release]; 

            }
            [pool1 drain];
        }
        [pool drain];
    }
}

这篇关于“数据格式化程序暂时不可用......”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆