简体   繁体   English

在模拟器上的iOS 4.3上运行时,应用程序将崩溃

[英]App will crash when run on iOS 4.3 in simulator

My app running perfectlly in iOS 5.1 and iOS 6.1. 我的应用程序可以在iOS 5.1和iOS 6.1上完美运行。 But wheen I try to run it on iOS 4.3 than it was crahing on this code: 但是,我想尝试在iOS 4.3上运行它,而不是在此代码上疯狂:

 [self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"home-active.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"home-normal"]];

I'm using this code to seting image on TabBar. 我正在使用此代码在TabBar上设置图像。

This is my log information. 这是我的日志信息。

2013-03-08 15:16:27.688 GrandNatural[3372:12c03] -[UITabBarItem setFinishedSelectedImage:withFinishedUnselectedImage:]: unrecognized selector sent to instance 0x628c090
2013-03-08 15:16:27.690 GrandNatural[3372:12c03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarItem setFinishedSelectedImage:withFinishedUnselectedImage:]: unrecognized selector sent to instance 0x628c090'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x019785a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x016e7313 objc_exception_throw + 44
    2   CoreFoundation                      0x0197a0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x018e9966 ___forwarding___ + 966
    4   CoreFoundation                      0x018e9522 _CF_forwarding_prep_0 + 50
    5   GrandNatural                        0x0000f8fe -[HomeViewController initWithNibName:bundle:] + 535
    6   GrandNatural                        0x00002985 -[GrandNaturalAppDelegate application:didFinishLaunchingWithOptions:] + 262
    7   UIKit                               0x00ce5c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
    8   UIKit                               0x00ce7d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
    9   UIKit                               0x00cf2617 -[UIApplication handleEvent:withNewEvent:] + 1533
    10  UIKit                               0x00ceaabf -[UIApplication sendEvent:] + 71
    11  UIKit                               0x00ceff2e _UIApplicationHandleEvent + 7576
    12  GraphicsServices                    0x021dd992 PurpleEventCallback + 1550
    13  CoreFoundation                      0x01959944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    14  CoreFoundation                      0x018b9cf7 __CFRunLoopDoSource1 + 215
    15  CoreFoundation                      0x018b6f83 __CFRunLoopRun + 979
    16  CoreFoundation                      0x018b6840 CFRunLoopRunSpecific + 208
    17  CoreFoundation                      0x018b6761 CFRunLoopRunInMode + 97
    18  UIKit                               0x00ce77d2 -[UIApplication _run] + 623
    19  UIKit                               0x00cf3c93 UIApplicationMain + 1160
    20  GrandNatural                        0x00002856 main + 132
    21  GrandNatural                        0x00002795 start + 53
)
terminate called throwing an exception(lldb) 

You can set image on tabbar using this code : 您可以使用以下代码在标签栏上设置图像:

if ([[[UIDevice currentDevice] systemVersion] floatValue]<5.0)
{  
   self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"your name" image:[UIImage imageNamed:@"home-normal"] tag:0];
}
else
{
   self.tabBarItem = [[UITabBarItem alloc] init];
   self.tabBarItem.title = @"your name";
   [self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"home-active"] withFinishedUnselectedImage:[UIImage imageNamed:@"home-normal"]];
}

Ok, go to the documentation page for UITabBarItem , find that method, and tell me what it says under Availability 好的,转到UITabBarItem文档页面 ,找到该方法,然后告诉我在可用性下的内容

I'll give you a hint: 4.3 is not valid. 我会给您一个提示:4.3无效。

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

相关问题 在调用initWithNibName后在iPhone 4.3模拟器上运行时,应用崩溃 - App crash when running on iPhone 4.3 simulator after calling initWithNibName 在iOS 4.3模拟器中使用xcode 4.6运行应用 - run app using xcode 4.6 in ios 4.3 simulator iOS 4.3在模拟器上的UITextField自动更正崩溃 - UITextField auto correction crash in iOS 4.3 on simulator iPhone应用程序在部署目标为5.0时在iOS 4.3上运行,而在部署目标为4.3的情况下不在ios 5.1上运行 - iPhone app runs on iOS 4.3 when deployment target is 5.0 and does not run on ios 5.1 when deployment target is 4.3 在Mountain Lion的4.3版上运行iOS应用 - Run a iOS App on version 4.3 on Mountain Lion 应用程序在设备上崩溃但在模拟器 iOS 上工作 - App crash on device but works on simulator iOS CLLocationManager无法在iOS 4.3模拟器中运行 - CLLocationManager is not working in the iOS 4.3 simulator iOS 应用程序在设备上自行运行时崩溃,在使用调试器或在模拟器中通过 Xcode 运行时不会崩溃 - iOS App Crashes when running by itself on device, does not crash when running through Xcode using debugger, or in simulator iOS 4.3上的奇怪崩溃问题 - Weird crash issue on iOS 4.3 无法在模拟器iOS 8 Xcode 6中运行应用程序 - Can't run app in the simulator iOS 8 Xcode 6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM