iOS 11只有崩溃的问题 – 当我点击一个标签栏应用程序崩溃
当我只从hometabviewcontroller点击一个特定的标签栏时,我得到以下崩溃错误。 这只发生在iOS 11.请帮我解决这个问题。
2017-10-23 16:48:57.000890+0400 FixtrProvider[2520:910402] desc: -[UIView refreshControl]: unrecognized selector sent to instance 0x10af090d0 2017-10-23 16:48:57.001223+0400 FixtrProvider[2520:910402] name: NSInvalidArgumentException 2017-10-23 16:48:57.001308+0400 FixtrProvider[2520:910402] user info: (null) 2017-10-23 16:48:57.001441+0400 FixtrProvider[2520:910402] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView refreshControl]: unrecognized selector sent to instance 0x10af090d0'
以下是根据请求我的HomeTabView控制器的整个页面。
@interface HomeTabBarController () { ChatSocketIOClient *socket; } @property (strong, nonatomic) UIButton *onTheJobOffTheJobButton; @property (strong, nonatomic) NSString *status; @property LocationTracker * locationTracker; @property (nonatomic) NSTimer* locationUpdateTimer; @end @implementation HomeTabBarController - (void)viewDidLoad { [super viewDidLoad]; // Crash bug fixing self.automaticallyAdjustsScrollViewInsets = NO; if (!socket) { socket =[ChatSocketIOClient sharedInstance]; } [self.navigationController setNavigationBarHidden:YES animated:YES]; [self tabbarImages]; } -(void)tabbarImages { NSString *homeunselect; NSString *homeselect; NSString *historyunselect; NSString *historyselect; NSString *scheduleunselect; NSString *scheduleselect; NSString *earnunselect; NSString *earnselect; NSString *proilfeunselect; NSString *profileselect; UITabBar *tabBar = self.tabBar; UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0]; UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1]; UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2]; UITabBarItem *tabBarItem4 = [tabBar.items objectAtIndex:3]; UITabBarItem *tabBarItem5 = [tabBar.items objectAtIndex:4]; if ([UIScreen mainScreen].bounds.size.height <= 568) { homeunselect = @"provider_popup_home_btn"; homeselect = @"provider_popup_home_btn_selector"; historyunselect = @"provider_popup_history_btn"; historyselect = @"provider_popup_history_btn_selector"; scheduleunselect = @"provider_popup_schedule_btn"; scheduleselect = @"provider_popup_selector_btn_selector"; earnunselect = @"provider_popup_earnings_btn"; earnselect = @"provider_popup_earnings_btn_selector"; proilfeunselect = @"provider_popup_profile_btn"; profileselect = @"provider_popup_profile_btn_selector"; }else if ([UIScreen mainScreen].bounds.size.height == 667){ homeunselect = @"6provider_popup_home_btn"; homeselect = @"6provider_popup_home_btn_selector"; historyunselect = @"6provider_popup_history_btn"; historyselect = @"6provider_popup_history_btn_selector"; scheduleunselect = @"6provider_popup_schedule_btn"; scheduleselect = @"6provider_popup_selector_btn_selector"; earnunselect = @"6provider_popup_earnings_btn"; earnselect = @"6provider_popup_earnings_btn_selector"; proilfeunselect = @"6provider_popup_profile_btn"; profileselect = @"6provider_popup_profile_btn_selector"; }else if ([UIScreen mainScreen].bounds.size.height >= 736){ homeunselect = @"6pprovider_popup_home_btn"; homeselect = @"6pprovider_popup_home_btn_selector"; historyunselect = @"6pprovider_popup_history_btn"; historyselect = @"6pprovider_popup_history_btn_selector"; scheduleunselect = @"6pprovider_popup_schedule_btn"; scheduleselect = @"6pprovider_popup_selector_btn_selector"; earnunselect = @"6pprovider_popup_earnings_btn"; earnselect = @"6pprovider_popup_earnings_btn_selector"; proilfeunselect = @"6pprovider_popup_profile_btn"; profileselect = @"6pprovider_popup_profile_btn_selector"; } tabBarItem1.selectedImage = [[UIImage imageNamed:homeselect] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ]; tabBarItem1.image = [[UIImage imageNamed:homeunselect] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ]; tabBarItem2.selectedImage = [[UIImage imageNamed:historyselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ]; tabBarItem2.image = [[UIImage imageNamed:historyunselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ]; tabBarItem3.selectedImage = [[UIImage imageNamed:scheduleselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ]; tabBarItem3.image = [[UIImage imageNamed:scheduleunselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ]; tabBarItem4.selectedImage = [[UIImage imageNamed:earnselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ]; tabBarItem4.image = [[UIImage imageNamed:earnunselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ]; tabBarItem5.selectedImage = [[UIImage imageNamed:profileselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ]; tabBarItem5.image = [[UIImage imageNamed:proilfeunselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ]; } -(void)viewWillAppear:(BOOL)animated{ [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"OnChatController"]; [[NSUserDefaults standardUserDefaults]synchronize]; self.tabBarController.tabBar.hidden = NO; [UIApplication sharedApplication].idleTimerDisabled = YES; } -(void)viewDidDisappear:(BOOL)animated{ }
当我在iOS 11中点击tabbar-4时,此应用程序崩溃。 我不明白我的代码有什么问题。 我没有得到任何代码相关的refreshController Hometabviewcontroller或accountscontroller。 但是当我search整个代码库时,我得到了以下内容。
- (void)refresh:(UIRefreshControl *)refreshControl { [refreshControl endRefreshing]; }
以下是特定tabview控制器的视图代码。
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; _paymentLogs.selected = YES; self.automaticallyAdjustsScrollViewInsets = NO; self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: UIColorFromRGB(0XfEAA26)}; } -(void)getFinancialData{ UIWindow *window = [[UIApplication sharedApplication]keyWindow]; [[ProgressIndicator sharedInstance] showPIOnWindow:window withMessge:NSLocalizedString(@"Loading...",@"Loading...")]; _pastCycle = [[NSMutableArray alloc]init]; NSDictionary *dict =@{ @"ent_sess_token": [[NSUserDefaults standardUserDefaults] objectForKey:KDAcheckUserSessionToken], @"ent_dev_id": [[NSUserDefaults standardUserDefaults] objectForKey:kPMDDeviceIdKey], @"ent_date_time":[Helper getCurrentDateTime], @"ent_pro_id": [[NSUserDefaults standardUserDefaults] objectForKey:@"ProviderId"] }; NetworkHandler *handler =[NetworkHandler sharedInstance]; [handler composeRequestWithMethod:@"GetFinancialData" paramas:dict onComplition:^(BOOL succeeded, NSDictionary *response) { if (succeeded) { _pastCycle = [response[@"pastCycle"] mutableCopy]; _currentCycle = response[@"currentCycle"]; NSLog(@"financial data %@",response); [self.currentTableView reloadData]; [self.pastTableView reloadData]; [[ProgressIndicator sharedInstance] hideProgressIndicator]; } }]; } -(void)viewWillAppear:(BOOL)animated{ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userSessionTokenExpire) name:@"HandleAcceptAndRejectFromAdmin" object:nil]; } -(void)viewWillDisappear:(BOOL)animated{ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"HandleAcceptAndRejectFromAdmin" object:nil]; } -(void)userSessionTokenExpire{ [[NSUserDefaults standardUserDefaults] removeObjectForKey:KDAcheckUserSessionToken]; [[NSUserDefaults standardUserDefaults] synchronize]; ProgressIndicator *pi = [ProgressIndicator sharedInstance]; [pi hideProgressIndicator]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName: @"Main" bundle:[NSBundle mainBundle]]; iServeSplashController *splah = [storyboard instantiateViewControllerWithIdentifier:@"splash"]; self.navigationController.viewControllers = [NSArray arrayWithObjects:splah, nil]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } -(void)viewDidAppear:(BOOL)animated { _pastCycle = [[NSMutableArray alloc]init]; [self getFinancialData]; [super viewDidAppear:animated]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(accountDeactivated) name:@"accountDeactivated" object:nil]; } -(void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; [[NSNotificationCenter defaultCenter] removeObserver:self]; }
您可以跟踪unrecognized selector sent to instance
的unrecognized selector sent to instance
来自哪里。 你的代码中的东西正在调用它。
在hometabviewcontroller
或整个项目中进行文本searchrefreshControl
,看看哪里和什么是调用它,并确保它是你想要的。
如果这没有帮助,我们需要更多的代码(最好hometabviewcontroller
)来帮助你。