views:

611

answers:

4

::Edit:: It works now? haha, maybe I just didn't save my latest IB...who the hell knows. Thanks!

Hey,

This is my first time playing around with desktop applications (I have experience with iphone applications) and I'm stuck - My text view will not update to show any text:

.m:
@synthesize textView;

    NSString *txt = [[[NSString alloc] initWithData:responseData encoding: NSASCIIStringEncoding] autorelease];
    NSLog(@"txt = %@", txt);
    [textView setString:txt];

.h:
    IBOutlet NSTextView *textView;
}
@property(nonatomic, retain) IBOutlet NSTextView *textView;

And IB says textView -> Text View, so everything looks good:

  • NSLog above outputs the contents of the url resource Im fetching

So, what am I missing?

+2  A: 

Double check if the outlets are done in IB. That's probably the reason (textView is probably nil here).

gcamp
My Controllers textView is set to the Text View in the nib (like I said in my description) - what exactly are you saying?
Mr-sk
I saw it in the description, but we often forget to do so. Put a break point and see if 'textView' is 'nil' there. Check if the nib is actually loaded.
gcamp
+2  A: 

where is this 'setString' code being called? It's possible the IB outlet isn't instantiated yet. You can check this with a simple

if (textView) NSLog(@"textView is not nil);

To be sure that everything is set up when you call this, make sure it's after 'awakeFromNib' is called in any objects created through IB.

See NSNibAwaking Protocal

bobDevil
A: 

Can you double check NSTextView properties like isEditable, textColor etc to make sure none of them are set incorrectly.

Other than that the code looks good.

Mihir Mathuria
A: 

I reconnected everything in IB, saved, rebuilt and it worked...= [

Mr-sk