App will crash when run on iOS 4.3 in simulator - iphone

My app running perfectlly in iOS 5.1 and iOS 6.1. But wheen I try to run it on iOS 4.3 than it was crahing on this code:
[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:#"home-active.png"] withFinishedUnselectedImage:[UIImage imageNamed:#"home-normal"]];
I'm using this code to seting image on 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
I'll give you a hint: 4.3 is not valid.

Related

getting error when presenting view controller

i am getting this error when trying to presenting view controller. actuallly i am testing this project on ios 4.3 simulator.on other simuators it works fine. this is non arc project. which is supported for ios 4.3 and onward.
request on uploadmanager:<NSMutableURLRequest http://www.livebinders.com/filetree/ipad>
2013-10-12 14:00:54.690 LiveBinders[1703:13b03] -[UploadManagerViewController presentViewController:animated:]: unrecognized selector sent to instance 0x6605a30
2013-10-12 14:00:54.695 LiveBinders[1703:13b03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UploadManagerViewController presentViewController:animated:]: unrecognized selector sent to instance 0x6605a30'
*** Call stack at first throw:
(
0 CoreFoundation 0x01ca85a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x017bc313 objc_exception_throw + 44
2 CoreFoundation 0x01caa0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01c19966 ___forwarding___ + 966
4 CoreFoundation 0x01c19522 _CF_forwarding_prep_0 + 50
5 LiveBinders 0x0003baa8 -[UploadManagerViewController openEvernote] + 248
6 LiveBinders 0x00068e4b -[TableVC tableView:didSelectRowAtIndexPath:] + 171
7 UIKit 0x00b97b68 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
8 UIKit 0x00b8db05 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219
9 Foundation 0x012a779e __NSFireDelayedPerform + 441
10 CoreFoundation 0x01c898c3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
11 CoreFoundation 0x01c8ae74 __CFRunLoopDoTimer + 1220
12 CoreFoundation 0x01be72c9 __CFRunLoopRun + 1817
13 CoreFoundation 0x01be6840 CFRunLoopRunSpecific + 208
14 CoreFoundation 0x01be6761 CFRunLoopRunInMode + 97
15 GraphicsServices 0x01dfc1c4 GSEventRunModal + 217
16 GraphicsServices 0x01dfc289 GSEventRun + 115
17 UIKit 0x00b2ec93 UIApplicationMain + 1160
18 LiveBinders 0x0000285d main + 93
19 LiveBinders 0x000027b5 start + 53
<----- calling this method on presenting new view controller ---->
-(void)openEvernote
{
self.dropboxShareLink = NULL;
self.dropBoxFileName = NULL;
EverNoteVC *everNoteVC = [[EverNoteVC alloc]initWithNibName:#"EverNoteView" bundle:nil];
everNoteVC.delegate = (id)self;
if (popoverController.isPopoverVisible) {
[popoverController dismissPopoverAnimated:NO];
}
[self presentViewController:everNoteVC animated:YES ];
[everNoteVC release];
}
presentViewController is not available in iOS versions prior 5.0.
Try with
[self presentModalViewController:everNoteVC animated:YES];
instead.

SDWebImage not working on Device

Hi guys I have integrated SDWebImage for loading image from Facebook. All things works fine on simulator but when I try to run on device it give error :
B'dayReminderPlus[415:307] -[UIImageView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x4f7d310
2012-08-17 14:45:15.301 B'dayReminderPlus[415:307] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x4f7d310'
*** Call stack at first throw:
(
0 CoreFoundation 0x3759dc7b __exceptionPreprocess + 114
1 libobjc.A.dylib 0x32d9bee8 objc_exception_throw + 40
2 CoreFoundation 0x3759f3e3 -[NSObject(NSObject) doesNotRecognizeSelector:] + 98
3 CoreFoundation 0x37544467 ___forwarding___ + 506
4 CoreFoundation 0x37544220 _CF_forwarding_prep_0 + 48
5 B'dayReminderPlus 0x000213e9 -[DLFirstScreenViewController tableView:cellForRowAtIndexPath:] + 5012
6 UIKit 0x359600a0 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 668
7 UIKit 0x3595fdcc -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 52
8 UIKit 0x3595db84 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1308
9 UIKit 0x3595c838 -[UITableView layoutSubviews] + 208
10 UIKit 0x358ec70c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 40
11 CoreFoundation 0x37538f79 -[NSObject(NSObject) performSelector:withObject:] + 24
12 QuartzCore 0x33d9a130 -[CALayer layoutSublayers] + 184
13 QuartzCore 0x33d99db8 CALayerLayoutIfNeeded + 200
14 QuartzCore 0x33d917c0 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 268
15 QuartzCore 0x33d91518 _ZN2CA11Transaction6commitEv + 284
16 QuartzCore 0x33dc3c28 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 88
17 CoreFoundation 0x3752a80f __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
18 CoreFoundation 0x3752a63d __CFRunLoopDoObservers + 500
19 CoreFoundation 0x3752199d __CFRunLoopRun + 940
20 CoreFoundation 0x3752150b CFRunLoopRunSpecific + 226
21 CoreFoundation 0x37521419 CFRunLoopRunInMode + 60
22 GraphicsServices 0x33e76d24 GSEventRunModal + 196
23 UIKit 0x3591d57c -[UIApplication _run] + 588
24 UIKit 0x3591a558 UIApplicationMain + 972
25 B'dayReminderPlus 0x00002703 main + 106
26 B'dayReminderPlus 0x00002694 start + 40
)
terminate called after throwing an instance of ‘NSException’
This crash is coming on :[cell.contactImageView setImageWithURL:[NSURL URLWithString:[[contactList objectAtIndex:indexPath.row] objectForKey:PICTURE_KEY]]placeholderImage:[UIImage imageNamed:#"placeholder.png"]];
I am not clear why this crash is happening while running APP on simulator. Any help would be appreciated. Thanx in advance.
I had this problem when running on device too. I forgot to add "-Objc" flag at "Other Linker Flags" settings.
Add Linker Flag
Open the "Build Settings" tab, in the "Linking" section, locate the
"Other Linker Flags" setting and add the "-ObjC" flag:

iOS exception handling problem

I have problem in following code.
int i = 10;
NSString *str;
#try {
//Error
str = [[NSString alloc] initWithFormat:#"%#",i];
//Warning
NSLog(#"%i",str);
}
#catch (id exception) {
NSLog(#"Hello !!!");
}
Please help me out how to handle exception in i/o operation.
Thanks.
Edited by Justin
there's no suitable place for me to provide this program to you, so i put it here.
try using the following program to reformulate your question:
static void bad_program() {
#try {
id array = [NSArray array];
NSLog(#"will throw...");
[array stringByAbbreviatingWithTildeInPath];
}
#catch (id exception) {
NSLog(#"\n*** Caught Exception:\n***** Exception Detail: %#\nResolution: Exception swallowed\n", exception);
}
}
# Justin, Result of above code
It does not fire exception. It is crashed showing following error.
Sorry Justin, please see if you could help me more. Thanks.
2011-08-25 15:06:48.444 TestError[5120:b303] will throw...
2011-08-25 15:06:48.446 TestError[5120:b303] -[__NSArrayI stringByAbbreviatingWithTildeInPath]: unrecognized selector sent to instance 0x4b38e10
2011-08-25 15:06:48.465 TestError[5120:b303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI stringByAbbreviatingWithTildeInPath]: unrecognized selector sent to instance 0x4b38e10'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc05a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f14313 objc_exception_throw + 44
2 CoreFoundation 0x00dc20bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d31966 ___forwarding___ + 966
4 CoreFoundation 0x00d31522 _CF_forwarding_prep_0 + 50
5 TestError 0x00002454 -[TestErrorViewController viewDidLoad] + 164
6 UIKit 0x000c2089 -[UIViewController view] + 179
7 UIKit 0x00035d42 -[UIWindow addRootViewControllerViewIfPossible] + 51
8 TestError 0x00002087 -[TestErrorAppDelegate application:didFinishLaunchingWithOptions:] + 135
9 UIKit 0x00012c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
10 UIKit 0x00014d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
11 UIKit 0x0001f617 -[UIApplication handleEvent:withNewEvent:] + 1533
12 UIKit 0x00017abf -[UIApplication sendEvent:] + 71
13 UIKit 0x0001cf2e _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x00ff9992 PurpleEventCallback + 1550
15 CoreFoundation 0x00da1944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00d01cf7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00cfef83 __CFRunLoopRun + 979
18 CoreFoundation 0x00cfe840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00cfe761 CFRunLoopRunInMode + 97
20 UIKit 0x000147d2 -[UIApplication _run] + 623
21 UIKit 0x00020c93 UIApplicationMain + 1160
22 TestError 0x00001fc9 main + 121
23 TestError 0x00001f45 start + 53
24 ??? 0x00000001 0x0 + 1
)
terminate called throwing an exceptionsharedlibrary apply-load-rules all
I got answer of this question.
Some exception cannnot catch and some exception will only work for device not on the simulator.

simple app crashing?

I have a very simple window based app, i am simply putting a navigation view controller as window's root view controller and it's crashing. This is the only thing i changed in the template project:
#interface AppDelegate : NSObject <UIApplicationDelegate> {
UINavigationController *navigationController;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
navigationController = [[UINavigationController alloc] init];
[[self window] setRootViewController:navigationController];
[self.window makeKeyAndVisible];
return YES;
}
It crashes saying:
2011-05-26 20:18:57.194 ZebraSDKTest[5560:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UICustomObject 0x8b3d760> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key navigationController.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dbf5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f13313 objc_exception_throw + 44
2 CoreFoundation 0x00dbf4e1 -[NSException raise] + 17
3 Foundation 0x00791677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x007915e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x0020d30c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00d358cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x0020bd23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x0020dab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x0001317a -[UIApplication _loadMainNibFile] + 172
10 UIKit 0x00013cf4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
11 UIKit 0x0001e617 -[UIApplication handleEvent:withNewEvent:] + 1533
12 UIKit
0x00016abf -[UIApplication sendEvent:] + 71
13 UIKit 0x0001bf2e _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x00ff8992 PurpleEventCallback + 1550
15 CoreFoundation 0x00da0944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00d00cf7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00cfdf83 __CFRunLoopRun + 979
18 CoreFoundation 0x00cfd840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00cfd761 CFRunLoopRunInMode + 97
20 UIKit 0x000137d2 -[UIApplication _run] + 623
21 UIKit 0x0001fc93 UIApplicationMain + 1160
22 ZebraSDKTest 0x00002549 main + 121
23 ZebraSDKTest 0x000024c5 start + 53
)
Looks like you have a connection to a former existing UINavigationController IBOutlet in one of your nib files.
Start with MainWindow.xib and check for such a connection.
I had this problem occurring on the simulator only, but on the device it was working fine.
I tried cleaning the project, restarting Xcode, debugging, emptying the simulator data, the whole works.
In the end it was resolved by uninstalling the app from the simulator and reinstalling it. No idea why that worked, but it solved it!

App crashes when I pop a view from NavigationController using a UIButton

I'm pushing a simple view onto a NavigationController. The view loads fine, and when I use the built-in back button, it is properly popped.
However, when I try and pop the view with my own UIButton within the view, I get a crash.
This is the action run by my UIButton:
-(IBAction)iAgreePressed {
[[self navigationController] popViewControllerAnimated:YES];}
Am I missing something obvious here?
This is the error coming back in the console:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LegalAgreementController iAgreePressed:]: unrecognized selector sent to instance 0x6169190'
*** Call stack at first throw:
(
0 CoreFoundation 0x0283ab99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0298a40e objc_exception_throw + 47
2 CoreFoundation 0x0283c6ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x027ac2b6 ___forwarding___ + 966
4 CoreFoundation 0x027abe72 _CF_forwarding_prep_0 + 50
5 UIKit 0x002d67f8 -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x00361de0 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x00364262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x00362e0f -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x002fa3d0 -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x002dbcb4 -[UIApplication sendEvent:] + 447
11 UIKit 0x002e09bf _UIApplicationHandleEvent + 7672
12 GraphicsServices 0x02f57822 PurpleEventCallback + 1550
13 CoreFoundation 0x0281bff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x0277c807 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x02779a93 __CFRunLoopRun + 979
16 CoreFoundation 0x02779350 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x02779271 CFRunLoopRunInMode + 97
18 GraphicsServices 0x02f5600c GSEventRunModal + 217
19 GraphicsServices 0x02f560d1 GSEventRun + 115
20 UIKit 0x002e4af2 UIApplicationMain + 1160
21 WeiglWorksMobileCommander 0x00001fa2 main + 84
22 WeiglWorksMobileCommander 0x00001f45 start + 53
23 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Thank you for your time!
Method signatures don't match. The button is sending
-[LegalAgreementController iAgreePressed:]
but you defined
-[LegalAgreementController iAgreePressed] //(note one arg versus no arg)
IBActions should be defined as:
- (IBAction) someMethod:(id)sender
You don't strictly have to include that arg, but you want to for consistency.