Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-27-2010, 08:43 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 3
evng is on a distinguished road
Default UITextView causing crash on load?

I am making an app that uses a UITableView to display a list of values and when you click on one of those values it opens another view which shows editable details in a UIView that has a UITextView in it.

I can run the app and have the detail view show with out a problem but when I connect the IBOutlet binding to the textview in IB and then run it, it will crash when I click a value in the Tableview and try to display the second view with the textview.

detail.h:

Code:
#import <UIKit/UIKit.h>


@interface detail : UIViewController <UITextViewDelegate> {
	IBOutlet UITextView *textview;
}
@property (nonatomic, retain) IBOutlet UITextView *textview;

@end
detail.m:

Code:
#import "detail.h"

@implementation detail
@synthesize textview; 

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)viewDidUnload {
    [super viewDidUnload];
}


- (void)dealloc {
    [textview release];
    [super dealloc];
}


@end
and the code in my RootViewController.m file that launches the detail view.

Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     UIViewController *detailViewController = [[UIViewController alloc] initWithNibName:@"detail" bundle:nil];
     [self.navigationController pushViewController:detailViewController animated:YES];
     [detailViewController release];
}
Thanks,
evng

Last edited by evng; 09-27-2010 at 08:47 PM.
evng is offline   Reply With Quote
Old 09-27-2010, 10:52 PM   #2 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 386
SoulRed12 is on a distinguished road
Default

One thing I do notice is that you've got a leak with the text view. You only release it once yet you have it in a property set to retain. I believe connecting it to an outlet gives it yet another retain count as well.

As for your problem though, I can't say from this code. Can you post the crash log? Specifically, run the app in debug mode (using build and debug, or cmd+option+y in Xcode), and when you get the crash, type "bt" in the console window and copy the output. (bt stands for backtrace. It'll give you the steps the app took that led up to the crash)
__________________
HEY! Was this post helpful?
If so, it would be MUCH appreciated if you'd just click on one of these apps:



MyD
Take 1 minute to set up your MyD and you'll always be able to prove you own your device!

Membrik
Test your memory by sliding tiles to match chains of increasing difficulty.

©2011 Dardom Productions | Like us on Facebook!
SoulRed12 is offline   Reply With Quote
Old 09-28-2010, 09:05 AM   #3 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 3
evng is on a distinguished road
Default

Quote:
Originally Posted by SoulRed12 View Post
One thing I do notice is that you've got a leak with the text view. You only release it once yet you have it in a property set to retain. I believe connecting it to an outlet gives it yet another retain count as well.

As for your problem though, I can't say from this code. Can you post the crash log? Specifically, run the app in debug mode (using build and debug, or cmd+option+y in Xcode), and when you get the crash, type "bt" in the console window and copy the output. (bt stands for backtrace. It'll give you the steps the app took that led up to the crash)
Code:
2010-09-28 09:52:10.861 UntitledApp[9357:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x6430120> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key textview.'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x0265db99 __exceptionPreprocess + 185
	1   libobjc.A.dylib                     0x027ad40e objc_exception_throw + 47
	2   CoreFoundation                      0x0265dad1 -[NSException raise] + 17
	3   Foundation                          0x000340f3 _NSSetUsingKeyValueSetter + 135
	4   Foundation                          0x00034061 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
	5   UIKit                               0x004b270a -[UIRuntimeOutletConnection connect] + 112
	6   CoreFoundation                      0x025d3d0f -[NSArray makeObjectsPerformSelector:] + 239
	7   UIKit                               0x004b1121 -[UINib instantiateWithOwner:options:] + 1041
	8   UIKit                               0x004b2eb5 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
	9   UIKit                               0x0036895f -[UIViewController _loadViewFromNibNamed:bundle:] + 70
	10  UIKit                               0x00366675 -[UIViewController loadView] + 120
	11  UIKit                               0x0036654f -[UIViewController view] + 56
	12  UIKit                               0x003649f4 -[UIViewController contentScrollView] + 42
	13  UIKit                               0x003747e2 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
	14  UIKit                               0x00372ea3 -[UINavigationController _layoutViewController:] + 43
	15  UIKit                               0x00374067 -[UINavigationController _startTransition:fromViewController:toViewController:] + 326
	16  UIKit                               0x0036eccd -[UINavigationController _startDeferredTransitionIfNeeded] + 266
	17  UIKit                               0x00375d8b -[UINavigationController pushViewController:transition:forceImmediate:] + 876
	18  UIKit                               0x0036eb67 -[UINavigationController pushViewController:animated:] + 62
	19 UntitledApp                         0x000039df -[RootViewController tableView:didSelectRowAtIndexPath:] + 146
	20  UIKit                               0x0032fa48 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
	21  UIKit                               0x0032632e -[UITableView _userSelectRowAtIndexPath:] + 219
	22  Foundation                          0x0003b21a __NSFireDelayedPerform + 441
	23  CoreFoundation                      0x0263ef73 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
	24  CoreFoundation                      0x026405b4 __CFRunLoopDoTimer + 1364
	25  CoreFoundation                      0x0259cdd9 __CFRunLoopRun + 1817
	26  CoreFoundation                      0x0259c350 CFRunLoopRunSpecific + 208
	27  CoreFoundation                      0x0259c271 CFRunLoopRunInMode + 97
	28  GraphicsServices                    0x02f3c00c GSEventRunModal + 217
	29  GraphicsServices                    0x02f3c0d1 GSEventRun + 115
	30  UIKit                               0x002caaf2 UIApplicationMain + 1160
	31  UntitledApp                         0x00002610 main + 102
	32  UntitledApp                        0x000025a1 start + 53
)
terminate called after throwing an instance of 'NSException'
evng is offline   Reply With Quote
Old 09-28-2010, 12:28 PM   #4 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 386
SoulRed12 is on a distinguished road
Default

It looks like there's an issue with interface builder (the reason being that from your stack trace, I'm seeing that there's a problem with initWithNibName, but you don't have a custom implementation of it). I'd try two things.

First, go into interface builder, and check on the lower right corner of the interface builder window where it shows you your file owner, view, first responder, etc. for either a yellow warning symbol or a red error symbol. If that's there, be sure to click it and see what it says.

Otherwise, I'd try deleting the text view, and creating it anew by dragging it from the library. Then try connecting that new text view.
__________________
HEY! Was this post helpful?
If so, it would be MUCH appreciated if you'd just click on one of these apps:



MyD
Take 1 minute to set up your MyD and you'll always be able to prove you own your device!

Membrik
Test your memory by sliding tiles to match chains of increasing difficulty.

©2011 Dardom Productions | Like us on Facebook!
SoulRed12 is offline   Reply With Quote
Old 09-29-2010, 07:34 PM   #5 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 3
evng is on a distinguished road
Default

I did both options multiple times and still no avail. Any other options you know of?

Thanks for the help btw.
evng is offline   Reply With Quote
Old 09-29-2010, 09:12 PM   #6 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 386
SoulRed12 is on a distinguished road
Default

According to some research (namely this thread), the particular error you're getting seems to have to do with having created a class, set IB to use that class, and then deleted the class. Have you deleted any class files recently?
__________________
HEY! Was this post helpful?
If so, it would be MUCH appreciated if you'd just click on one of these apps:



MyD
Take 1 minute to set up your MyD and you'll always be able to prove you own your device!

Membrik
Test your memory by sliding tiles to match chains of increasing difficulty.

©2011 Dardom Productions | Like us on Facebook!
SoulRed12 is offline   Reply With Quote
Reply

Bookmarks

Tags
rootviewcontroller, uitextview, uiview, view

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 355
6 members and 349 guests
headkaze, mistergreen2011, nobstudio, Objective Zero, revg, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:08 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0