简体   繁体   English

在iOS7中发行,在iOS6中正常

[英]Issue in iOS7, fine in iOS6

Below is the error i am getting in my app, which is working fine in ios6. 以下是我在应用程序中遇到的错误,在iOS6中可以正常工作。

[__NSCFString frame]: unrecognized selector sent to instance 0xc075290

I am not getting what is wrong in it. 我没有明白其中有什么问题。 But i guess something related to UINavigationController . 但是我想与UINavigationController有关的东西。 Please guide for above. 请指导以上。 Thanks in advance. 提前致谢。

UPDATE: After enabling Zombies i get this error. 更新:启用僵尸后,我得到此错误。

[_UINavigationBarBackIndicatorView frame]: message sent to deallocated instance 0xc0fb860

-(void)viewWillAppear:(BOOL)animated
{
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"isAcceptTerms"]) {
    [adBannerView setDelegate:self];
    [adBannerView setHidden:NO];

    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"isBannerShown"]) //-ive logic is applied 
    {
        [self.adBannerView setHidden:YES];
        [self.adBannerView setDelegate:nil];
    }
}
else
{
    [adBannerView setDelegate:nil];
    [adBannerView setHidden:YES];
}

[self.navigationController.navigationBar setHidden:NO];
NSMutableDictionary *dictTemp =[[sqlmessenger shared]fetchOrders];
int count=[[sqlmessenger shared] isuserdetails];

if (count>0)
{
    [self updateCoordinate];
}

NSArray *arrContorl = [self.navigationController.navigationBar subviews];
for(UIButton *btnTemp in arrContorl)
{
    if([btnTemp isKindOfClass:[UIButton class]])
    {
        [btnTemp removeFromSuperview];
    }
}       

UIImageView *imgHeader= [[UIImageView alloc]initWithFrame:CGRectMake(0,0,320,44)];
[imgHeader setBackgroundColor:[UIColor clearColor]];
[imgHeader setImage:[UIImage imageNamed:@"setting.png"]];
[self.navigationController.navigationBar addSubview:imgHeader];

if(lblHeader)
{
    lblHeader=nil ; 
}

lblHeader  = [[UILabel alloc]initWithFrame:CGRectMake(60,5,230,30)];
[lblHeader setBackgroundColor:[UIColor clearColor]];
[lblHeader setTextAlignment:UITextAlignmentLeft];
[lblHeader setTextColor:[UIColor whiteColor]];
[lblHeader setFont:[UIFont boldSystemFontOfSize:18.0]];
if([dictTemp count]==0 && contentView.hidden == FALSE)
{
    [lblHeader setText:@"Terms of Service (EULA)"];
}
else 
{
    [lblHeader setFrame:CGRectMake(110,5,200,30)];
    [lblHeader setFont:[UIFont boldSystemFontOfSize:20.0]];
    [lblHeader setText:@"Settings"];
}

[self.navigationController.navigationBar addSubview:lblHeader];
 }

Obviously, you are trying to access the frame property of a NSString object, which is not permitted, since this object does not have this property. 显然,您正在尝试访问NSString对象的frame属性,这是不允许的,因为该对象没有此属性。

Try adding more details. 尝试添加更多详细信息。 (Add the code that causes the crash, usually crash stack are not that helpful). (添加导致崩溃的代码,通常崩溃堆栈没有帮助)。

UPDATE : Still not sure what's going on, you need to do the actual debug, plant the necessary breakpoints log your variables, see what values they have etc. I can give you some things you can try: 更新 :仍不确定发生了什么,您需要进行实际的调试,在必要的断点处植入变量,记录变量的值,等等。我可以给您一些尝试的方法:

1.Not sure why are you adding subviews to the navigation bar. 1.不确定为什么要向导航栏添加子视图。 You can instead use the navigationItem property of the UIViewController , and then leftBarButtonItem of UINavigationItem , like : 您可以改为使用UIViewController的navigationItem属性,然后使用UINavigationItem leftBarButtonItem,例如:

For left bar button item : (make sure you hide the back button first) 对于左栏按钮项目:(确保先隐藏后退按钮)

self.navigationController.navigationItem.hidesBackButton = YES;
self.navigationItem.leftBarButtonItem = yourLeftBarButtonItem;

And for the right one : 对于正确的一个:

self.navigationItem.rightBarButtonItem = yourRightBarButtonItem;

2.You're allocating the view and the label each time that viewController is appearing. 2.每次出现viewController时,都要分配视图和标签。 That's inefficient. 效率低下。 Both memory and time-wise. 无论是记忆力还是时间。 Instead, you can allocate them once and change the alpha channels. 相反,您可以分配它们一次并更改alpha通道。

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

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