I have a TTSplitViewController in which I am trying to show a UITabBarController at the left pane, via the code:
#implementation SplitAppController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
[self setupURLRouting];
}
return self;
}
- (void)setupURLRouting {
[self routePrimaryNavigator];
[self routeDetailsNavigator];
}
- (void)routePrimaryNavigator {
TTURLMap* map = self.primaryNavigator.URLMap;
// Forward all unhandled URL actions to the right navigator.
[map from: #"*" toObject: self selector: #selector(willOpenUrlPath:)];
[map from:#"tt://primary" toViewController:[RootViewController class]];
}
RootViewController here is a UITabBarController. However, I am getting the following error:
2011-07-08 08:04:23.739 app[3241:207] -[RootViewController topViewController]: unrecognized selector sent to instance 0x520c060
2011-07-08 08:04:23.755 app[3241:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RootViewController topViewController]: unrecognized selector sent to instance 0x520c060'
*** Call stack at first throw:
(
0 CoreFoundation 0x017d95a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0192d313 objc_exception_throw + 44
2 CoreFoundation 0x017db0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0174a966 ___forwarding___ + 966
4 CoreFoundation 0x0174a522 _CF_forwarding_prep_0 + 50
5 app 0x000f73ff -[TTSplitViewController updateSplitViewButton] + 176
6 app 0x000f75d9 -[TTSplitViewController viewDidAppear:] + 90
7 UIKit 0x00ae1fab -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 694
8 UIKit 0x00a64e4b -[UIView(Internal) _didMoveFromWindow:toWindow:] + 918
9 UIKit 0x00a63a60 -[UIView(Hierarchy) _postMovedFromSuperview:] + 166
10 UIKit 0x00a5c750 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1080
11 UIKit 0x00a5aaa3 -[UIView(Hierarchy) addSubview:] + 57
12 app 0x00083d01 -[TTBaseNavigator setRootViewController:] + 306
13 app 0x000841f9 -[TTBaseNavigator presentController:parentController:mode:action:] + 70
14 app 0x00084437 -[TTBaseNavigator presentController:parentURLPath:withPattern:action:] + 359
15 app 0x00084975 -[TTBaseNavigator openURLAction:] + 1320
16 app 0x0000c440 -[appAppDelegate application:didFinishLaunchingWithOptions:] + 848
17 UIKit 0x00a2bc89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
18 UIKit 0x00a2dd88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
19 UIKit 0x00a38617 -[UIApplication handleEvent:withNewEvent:] + 1533
20 UIKit 0x00a30abf -[UIApplication sendEvent:] + 71
21 UIKit 0x00a35f2e _UIApplicationHandleEvent + 7576
22 GraphicsServices 0x01fee992 PurpleEventCallback + 1550
23 CoreFoundation 0x017ba944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
24 CoreFoundation 0x0171acf7 __CFRunLoopDoSource1 + 215
25 CoreFoundation 0x01717f83 __CFRunLoopRun + 979
26 CoreFoundation 0x01717840 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x01717761 CFRunLoopRunInMode + 97
28 UIKit 0x00a2d7d2 -[UIApplication _run] + 623
29 UIKit 0x00a39c93 UIApplicationMain + 1160
30 app 0x00031342 main + 130
31 app 0x00002a75 start + 53
)
terminate called after throwing an instance of 'NSException'
How do I fix this?
Seems like your code is expecting RootViewController to be a subclass of UINavigationController.
If you didn't write that code, you can make a UINavigationController subclass, and initialize it with your tab bar controller as a root view controller, and hide the navigation bar, I think this would give the results you are looking for.
EmilioPelaez is quite right, I just succeeded with a similar solution like this, and it works!
#implementation MainViewController
- (id)initWithNavigatorURL:(NSURL *)URL query:(NSDictionary *)query {
MainTabBarController *mainTabBarController = [[MainTabBarController alloc] init];
[mainTabBarController setTabURLs:[NSArray arrayWithObjects:
#"tt://firstLink",
#"tt://secondLink",
nil]];
self = [super initWithRootViewController:mainTabBarController];
[mainTabBarController release];
self.navigationBarHidden = YES;
return self;
}
#end
I found another way to make it work (and maybe the better way that reduce code complexity):
inherit UITabBarController with this additional method:
- (UIViewController *)topViewController {
return self;
}
It works perfectly.
is this right
[map from:#"tt://primary" toViewController:[RootViewController class]];
my suggestion is
[map from:#"tt://primary" toViewController:RootViewControllerobject];
Related
I am creating my first iPhone app in which the first screen displays a table view the user selects from. It works before localization using the method below.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
navigationController = [[UINavigationController alloc] init];
[self.window addSubview:[self.navigationController view]];
if(self.selectCategoryViewController == nil)
{
SelectCategoryViewController *viewTwo = [[SelectCategoryViewController alloc] initWithNibName:#"SelectCategoryViewController" bundle:[NSBundle mainBundle]];
self.selectCategoryViewController = viewTwo;
[viewTwo release];
}
[self.navigationController setNavigationBarHidden:YES];//this will hide the navigation bar
[self.navigationController pushViewController:self.selectCategoryViewController animated:YES];
//self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
After I localized it by adding the Japanese localization file and changing the above to this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
navigationController = [[UINavigationController alloc] init];
[self.window addSubview:[self.navigationController view]];
if(self.selectCategoryViewController == nil)
{
NSBundle *myLocalizedBundle=[NSBundle bundleWithPath:[NSString stringWithFormat:[[NSBundle mainBundle]bundlePath],"en.lproj"]];
NSLog(#"the localized bundle is %#",myLocalizedBundle);
SelectCategoryViewController *viewTwo=[[SelectCategoryViewController alloc] initWithNibName:#"SelectCategoryViewController" bundle:myLocalizedBundle];
self.selectCategoryViewController = viewTwo;
[viewTwo release];
}
[self.navigationController setNavigationBarHidden:YES];//this will hide the navigation bar
[self.navigationController pushViewController:self.selectCategoryViewController animated:YES];
[self.window makeKeyAndVisible];
return YES;
}
it crashes with the following error:
√sh.app> (loaded)
2013-02-18 18:04:35.196 PictureEnglish[5529:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFString substringFromIndex:]: Range or index out of bounds'
*** Call stack at first throw:
(
0 CoreFoundation 0x012775a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x013cb313 objc_exception_throw + 44
2 CoreFoundation 0x0122fef8 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0122fe6a +[NSException raise:format:] + 58
4 Foundation 0x00033086 -[NSString substringFromIndex:] + 133
5 PictureEnglish 0x00008524 -[SelectCategoryViewController viewDidLoad] + 937
6 UIKit 0x00378089 -[UIViewController view] + 179
7 UIKit 0x00376482 -[UIViewController contentScrollView] + 42
8 UIKit 0x00386f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
9 UIKit 0x00385555 -[UINavigationController _layoutViewController:] + 43
10 UIKit 0x00386870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
11 UIKit 0x0038132a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
12 UIKit 0x0049c2e9 -[UILayoutContainerView layoutSubviews] + 226
13 QuartzCore 0x010a7a5a -[CALayer layoutSublayers] + 181
14 QuartzCore 0x010a9ddc CALayerLayoutIfNeeded + 220
15 QuartzCore 0x0104f0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
16 QuartzCore 0x01050294 _ZN2CA11Transaction6commitEv + 292
17 UIKit 0x002ca9c9 -[UIApplication _reportAppLaunchFinished] + 39
18 UIKit 0x002cae83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
19 UIKit 0x002d5617 -[UIApplication handleEvent:withNewEvent:] + 1533
20 UIKit 0x002cdabf -[UIApplication sendEvent:] + 71
21 UIKit 0x002d2f2e _UIApplicationHandleEvent + 7576
22 GraphicsServices 0x01bcf992 PurpleEventCallback + 1550
23 CoreFoundation 0x01258944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
24 CoreFoundation 0x011b8cf7 __CFRunLoopDoSource1 + 215
25 CoreFoundation 0x011b5f83 __CFRunLoopRun + 979
26 CoreFoundation 0x011b5840 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x011b5761 CFRunLoopRunInMode + 97
28 UIKit 0x002ca7d2 -[UIApplication _run] + 623
29 UIKit 0x002d6c93 UIApplicationMain + 1160
30 PictureEnglish 0x00001cec main + 102
31 PictureEnglish 0x00001c7d start + 53
32 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Any suggestions on how I should call the SelectCategoryViewController for the selected language?
This line looks wrong to me:
NSBundle *myLocalizedBundle=[NSBundle bundleWithPath:[NSString stringWithFormat:[[NSBundle mainBundle]bundlePath],"en.lproj"]];
You probably meant something like this:
NSString* path= [[NSBundle mainBundle] pathForResource:#"en" ofType:#"lproj"];
NSBundle* bundle:myLocalizedBundle = [NSBundle bundleWithPath:path];
SelectCategoryViewController *viewTwo = [[SelectCategoryViewController alloc] initWithNibName:#"SelectCategoryViewController" bundle:myLocalizedBundle];
This is discussed more here: Manually loading a different localized nib in iOs
Note that this is only required if you want to do an in-app language selection. Localization should typically use the iOS device's selected language, in which case all this is much more straightforward (you simply let iOS pick the bundle for you).
xcode 5:
i had to clean build, clean build folder,delete derived data, reset simulator, close simulator, close Xcode.
Open project again and it's working.
Problem - This is a problem of project path, I think [self.window makeWindowKeyVisible] can not be able to find a path to your first assigned controller...
Solution - It happens some time, when your project suddenly stopped work, So no worries - just shift your project to other path, or just change the name of folder where actually your project resides and it will started working fine....
It works for me successfully...
My application crashing ans showing following in console. How to remove this exception???
2011-11-25 17:47:56.519 ShowroomLocator[1482:707] -[ShowroomLocatorViewController length]: unrecognized selector sent to instance 0x164860
2011-11-25 17:47:56.541 ShowroomLocator[1482:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [ShowroomLocatorViewController length]: unrecognized selector sent to instance 0x164860'
*** Call stack at first throw:
(
0 CoreFoundation 0x308aa64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x3400bc5d objc_exception_throw + 24
2 CoreFoundation 0x308ae1bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x308ad649 ___forwarding___ + 508
4 CoreFoundation 0x30824180 _CF_forwarding_prep_0 + 48
5 UIKit 0x35dcfed1 - [UITableView(UITableViewInternal) _delegateWantsHeaderForSection:] + 228
6 UIKit 0x35dcf2db -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 78
7 UIKit 0x35dcf225 -[UITableViewRowData numberOfRows] + 72
8 UIKit 0x35dcec73 -[UITableView noteNumberOfRowsChanged] + 82
9 UIKit 0x35dce7f7 -[UITableView reloadData] + 582
10 HettichShowroomLocator 0x00003487 - [ShowroomLocatorViewController viewWillAppear:] + 50
11 UIKit 0x35dbf1d9 -[UIViewController viewWillMoveToWindow:] + 64
12 UIKit 0x35d9e179 -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] + 132
13 UIKit 0x35d83a59 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 228
14 UIKit 0x35d8396b -[UIView(Hierarchy) addSubview:] + 22
15 UIKit 0x35db335f -[UIWindow addRootViewControllerViewIfPossible] + 202
16 UIKit 0x35daf333 -[UIWindow _setHidden:forced:] + 182
17 UIKit 0x35db328f -[UIWindow _orderFrontWithoutMakingKey] + 18
18 UIKit 0x35dc1c61 -[UIWindow makeKeyAndVisible] + 16
19 ShowroomLocator 0x0000285b - [ShowroomLocatorAppDelegate application:didFinishLaunchingWithOptions:] + 162
20 UIKit 0x35db3821 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 772
21 UIKit 0x35dadb65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272
22 UIKit 0x35d827d7 -[UIApplication handleEvent:withNewEvent:] + 1114
23 UIKit 0x35d82215 -[UIApplication sendEvent:] + 44
24 UIKit 0x35d81c53 _UIApplicationHandleEvent + 5090
25 GraphicsServices 0x35a56e77 PurpleEventCallback + 666
26 CoreFoundation 0x30881a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
27 CoreFoundation 0x3088383f __CFRunLoopDoSource1 + 166
28 CoreFoundation 0x3088460d __CFRunLoopRun + 520
29 CoreFoundation 0x30814ec3 CFRunLoopRunSpecific + 230
30 CoreFoundation 0x30814dcb CFRunLoopRunInMode + 58
31 UIKit 0x35dacd49 -[UIApplication _run] + 372
32 UIKit 0x35daa807 UIApplicationMain + 670
33 ShowroomLocator 0x0000278b main + 70
34 ShowroomLocator 0x00002740 start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.2 (8H7)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).
(gdb)
After adding SearchDisplayController with _tableview1 my application started crashing.
I have two tableview in same controller class. Pleas suggest something to handle this...
Edited with multiple tableview coding:
- (void)viewDidLoad {
appDelegate = (ShowroomLocatorAppDelegate *)[[UIApplication sharedApplication] delegate];
NSArray *items = [[NSArray alloc] initWithObjects:
#"Sydney Airport (SYD), Mascot NSW 2020, Australia",
#"Sydney NSW, Australia'",
#"Smithfield NSW 2164, Australia",
#"Smithfield SA 5114, Australia",
#"Smithfield QLD 4878, Australia",
nil];
self.allItems = items;
[items release];
self._tableView1.scrollEnabled = YES;
_tableView1.hidden = YES;
_tableView.hidden = YES;
[self._tableView reloadData];
self._tableView.rowHeight = 80.0;
[ self.view addSubview:_tableView] ;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView1.delegate = self;
_tableView1.dataSource = self;
}
- (void)viewWillAppear:(BOOL)animated
{
[self._tableView reloadData];
[self._tableView1 reloadData]; }
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
if(tableView ==_tableView && tableView ==_tableView1 )
{
return 1;
}
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
if(tableView ==_tableView )
{
if(section == 0)
return [NSString stringWithFormat:NSLocalizedString(#"ShowRooms[%d]", #"Showroom format"), [appDelegate.markers count]];
}
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableview numberOfRowsInSection:(NSInteger)section {
if(tableview ==_tableView )
{
return [appDelegate.markers count];
}
if(tableview ==_tableView1 )
{ NSInteger rows = 0;
if ([_tableView1
isEqual:self.searchDisplayController.searchResultsTableView]){
rows = [self.searchResults count];
}
else{
rows = [self.allItems count];
}
return rows;
}
}
In my _tableview web-service data get fill and _tableview1 array data with address get fill.....
The above error is coming on adding _tableview1.....
I suspect, in viewWillAppear, you did a reloadData specifying self rather than self.tableView.
I have create a demo project in which i have add button. On button action i am calling a custom view. On that custom view i have add a picker view, a toolbar and bar button. On action of button i am calling that custom view. I have used this code...
-(IBAction)Picker{
mpv_object = [[MyPickerView alloc] initWithNibName:#"MyPickerView" bundle:nil];
[self.view addSubview:mpv_object];
[mpv_object release];
}
But i give error which i given below...
2011-09-26 09:49:00.236 Web[440:207] -[MyPickerView initWithNibName:bundle:]: unrecognized selector sent to instance 0x4b4dcb0
2011-09-26 09:49:00.287 Web[440:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyPickerView initWithNibName:bundle:]: unrecognized selector sent to instance 0x4b4dcb0'
* Call stack at first throw:
(
0 CoreFoundation 0x00daebe9 exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f035c2 objc_exception_throw + 47
2 CoreFoundation 0x00db06fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d20366 __forwarding + 966
4 CoreFoundation 0x00d1ff22 _CF_forwarding_prep_0 + 50
5 Web 0x0000223a -[WebViewController Picker] + 102
6 UIKit 0x002b7a6e -[UIApplication sendAction:to:from:forEvent:] + 119
7 UIKit 0x003461b5 -[UIControl sendAction:to:forEvent:] + 67
8 UIKit 0x00348647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
9 UIKit 0x003471f4 -[UIControl touchesEnded:withEvent:] + 458
10 UIKit 0x002dc0d1 -[UIWindow _sendTouchesForEvent:] + 567
11 UIKit 0x002bd37a -[UIApplication sendEvent:] + 447
12 UIKit 0x002c2732 _UIApplicationHandleEvent + 7576
13 GraphicsServices 0x016e4a36 PurpleEventCallback + 1550
14 CoreFoundation 0x00d90064 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 52
15 CoreFoundation 0x00cf06f7 __CFRunLoopDoSource1 + 215
16 CoreFoundation 0x00ced983 __CFRunLoopRun + 979
17 CoreFoundation 0x00ced240 CFRunLoopRunSpecific + 208
18 CoreFoundation 0x00ced161 CFRunLoopRunInMode + 97
19 GraphicsServices 0x016e3268 GSEventRunModal + 217
20 GraphicsServices 0x016e332d GSEventRun + 115
21 UIKit 0x002c642e UIApplicationMain + 1160
22 Web 0x00001f80 main + 102
23 Web 0x00001f11 start + 53
)
terminate called after throwing an instance of 'NSException'
What is error in this?
It sounds like MyPickerView is a UIView subclass. initWithNibName:bundle is not a method that exists on UIView subclasses. It is a method that exists on UIViewController subclasses. That is what the error message means.
unrecognized selector sent to instance suggests that MyPickerView's superclass doesn't know what initWithNibName:bundle is, which is because UIView doesn't know that method (it exists in UIViewController).
Right way to do this would be something like this
UIView *dpView;
NSArray *nibViews;
nibViews = [[NSBundle mainBundle] loadNibNamed:#"DatePickerSliderViewNew" owner:self options:nil];
dpView = [ nibViews objectAtIndex: 0];
int outside = CGRectGetMaxY(self.view.bounds);
dpView.frame = CGRectMake(0, outside, 320, 260);
[self.view addSubview:dpView];
[UIView beginAnimations:nil context:nil];
dpView.frame = CGRectMake(0, outside - 260, 320, 260);
[UIView commitAnimations];
Here is the code:
- (IBAction)textFieldDidBeginEditing:(UITextField *)textField
{
NSLog(#"Inside textfieldDidBeginEditing");
textFieldBeingEdited = textField;
}
//==============================================================================
-(IBAction)textFieldDoneEditing:(id)sender
{
textFieldBeingEdited = NULL;
[sender resignFirstResponder];
if (moveViewUp)
{
[self scrollTheView:NO];
}
}
//==============================================================================
-(void)keyboardWillShow:(NSNotification *)notif
{
NSLog(#"Inside keyborad will show");
NSDictionary *info = [notif userInfo];
NSValue *aValue = [info objectForKey:UIKeyboardFrameBeginUserInfoKey];
CGSize keyboardSize = [aValue CGRectValue].size;
float bottomPoint = (textFieldBeingEdited.frame.origin.y + textFieldBeingEdited.frame.size.height /*+ 20*/);
scrollAmount = keyboardSize.height - (self.view.frame.size.height- bottomPoint);
if(scrollAmount > 0)
{
moveViewUp = YES;
[self scrollTheView:YES];
}
else
{
moveViewUp = NO;
}
}
Here is the screen shot of the view controller
when I tap on any one of these text fields. An exception is thrown
-[__NSCFType textFieldDidBeginEditing:]: unrecognized selector sent to instance 0x5a3c100
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType textFieldDidBeginEditing:]: unrecognized selector sent to instance 0x5a3c100'
*** Call stack at first throw:
(
0 CoreFoundation 0x010275a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0117b313 objc_exception_throw + 44
2 CoreFoundation 0x010290bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00f98966 ___forwarding___ + 966
4 CoreFoundation 0x00f98522 _CF_forwarding_prep_0 + 50
5 UIKit 0x003a1581 -[UIControl(Deprecated) sendAction:toTarget:forEvent:] + 67
6 UIKit 0x003a3e62 -[UIControl(Internal) _sendActionsForEventMask:withEvent:] + 525
7 UIKit 0x003a9e11 -[UITextField willAttachFieldEditor:] + 404
8 UIKit 0x003bbcdf -[UIFieldEditor becomeFieldEditorForView:] + 653
9 UIKit 0x003abf98 -[UITextField _becomeFirstResponder] + 99
10 UIKit 0x003e02c3 -[UIResponder becomeFirstResponder] + 328
11 UIKit 0x005a8961 -[UITextInteractionAssistant setFirstResponderIfNecessary] + 208
12 UIKit 0x005ab5e2 -[UITextInteractionAssistant oneFingerTap:] + 1676
13 UIKit 0x005a24f2 -[UIGestureRecognizer _updateGestureWithEvent:] + 730
14 UIKit 0x0059e4fe -[UIGestureRecognizer _delayedUpdateGesture] + 47
15 UIKit 0x005a4afc _UIGestureRecognizerUpdateObserver + 584
16 UIKit 0x005a4ce1 _UIGestureRecognizerUpdateGesturesFromSendEvent + 51
17 UIKit 0x0033832a -[UIWindow _sendGesturesForEvent:] + 1292
18 UIKit 0x00333ca3 -[UIWindow sendEvent:] + 105
19 UIKit 0x00316c37 -[UIApplication sendEvent:] + 447
20 UIKit 0x0031bf2e _UIApplicationHandleEvent + 7576
21 GraphicsServices 0x0197f992 PurpleEventCallback + 1550
22 CoreFoundation 0x01008944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
23 CoreFoundation 0x00f68cf7 __CFRunLoopDoSource1 + 215
24 CoreFoundation 0x00f65f83 __CFRunLoopRun + 979
25 CoreFoundation 0x00f65840 CFRunLoopRunSpecific + 208
26 CoreFoundation 0x00f65761 CFRunLoopRunInMode + 97
27 GraphicsServices 0x0197e1c4 GSEventRunModal + 217
28 GraphicsServices 0x0197e289 GSEventRun + 115
29 UIKit 0x0031fc93 UIApplicationMain + 1160
terminate called after throwing an instance of 'NSException'
please help
Shouldn't the method signature be:
-(void)textFieldDidBeginEditing:(UITextField *)textField
i.e. (void) instead of (IBAction)
Hell All,
I am new to iPhone and struggling with following problem.
When i remove scroll view with following statement my appli crashes.
[scrollView removeFromSuperview];
I am adding uiscrollview with following line.
[self.view addSubview:scrollView];
Hereis the log.
Thread 0 Crashed:
0 libobjc.A.dylib 0x34a80466 objc_msgSend + 18
1 UIKit 0x341aaaa8 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 152
2 UIKit 0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190
3 UIKit 0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190
4 UIKit 0x341c05a0 -[UIView(Hierarchy) removeFromSuperview] + 208
5 UIKit 0x34249a76 -[UIScrollView removeFromSuperview] + 42
6 KabushikiShimbun 0x000387b6 -[PDFPageScrollViewController ReGenerateScrollViewAsperNewData] (PDFPageScrollViewController.m:1451)
7 KabushikiShimbun 0x00038aac -[PDFPageScrollViewController CheckPageUpdationWithDate:] (PDFPageScrollViewController.m:1441)
8 KabushikiShimbun 0x0003c472 -[PDFPageScrollViewController requestFinished:] (PDFPageScrollViewController.m:792)
9 CoreFoundation 0x35818bb8 -[NSObject(NSObject) performSelector:withObject:] + 16
10 KabushikiShimbun 0x0000e9ba -[ASIHTTPRequest reportFinished] (ASIHTTPRequest.m:1945)
11 CoreFoundation 0x35818bb8 -[NSObject(NSObject) performSelector:withObject:] + 16
12 Foundation 0x3118178e __NSThreadPerformPerform + 262
13 CoreFoundation 0x358307d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
14 CoreFoundation 0x358025b0 __CFRunLoopDoSources0 + 376
15 CoreFoundation 0x35801e54 __CFRunLoopRun + 224
16 CoreFoundation 0x35801c80 CFRunLoopRunSpecific + 224
17 CoreFoundation 0x35801b88 CFRunLoopRunInMode + 52
18 GraphicsServices 0x320c84a4 GSEventRunModal + 108
19 GraphicsServices 0x320c8550 GSEventRun + 56
20 UIKit 0x341dc322 -[UIApplication _run] + 406
21 UIKit 0x341d9e8c UIApplicationMain + 664
22 KabushikiShimbun 0x00002da6 main (main.m:14)
23 KabushikiShimbun 0x00002d70 start + 32
Any Idea ?
Thank you.
Check whether it has a superview before removing from superview;
if([scrollView superview]!=nil){
[scrollView removeFromSuperview];
}
Try this code
for(UIView *view in self.view.subviews)
{
if([view isMemberOfClass:[UIScrollView class]])
{
[scrollview removeFromSuperView];
}
}
Try this code. It's tested.
NSArray *subviews = [[NSArray alloc] initWithArray:self.view.subviews];
for(UIScrollView *subview in subviews) {
[subview removeFromSuperView];
}
[subviews release];
but be carefull it removes all ScrollViews present in your self.view