Reputation: 69
Here is the complete .m file :
#import "DevotionalView.h"
@implementation DevotionalView
@synthesize mytextview;
@synthesize mystring;
- {void} awakeFromNib {
NSURL *myurl = [NSURL URLWithString:@"http://www.myserver.com/text.txt"];
NSString *mystring = [NSString stringWithContentOfURL:myurl];
mytextview.text = mystring;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
@end
The errors are: '@end' is missing in implementation context --where the @implementation DevotionalView is-- and at the {void} line it says Expected selector for objective-c method.
Thanks for taking the time to help!
The errors are: '@end' is missing in implementation context --where the @implementation DevotionalView is-- and at the {void} line it says Expected selector for objective-c method. Also, at the end of the file it say "expected method body"
Seems to work fine in the tutorial I followed, but it will not compile in XCode 4.3.
I'm using Storyboard-- will this change the part about NIB? I apologize for my lack of knowledge-- still getting used to this.
Thanks for any help!
Upvotes: 1
Views: 849
Reputation: 69
Well, I finally worked around it-- from my searches it would appear that I had either messed up a delegate assignment or some such thing. So...(and you pros might groan at this) I opened up a new project (single view with a controller) and copied and pasted the controller, .h and .m files in, then used this code:
- (void)viewDidLoad
{NSError *error = nil;
NSURL *myurl = [NSURL URLWithString:@"http://www.myserver.com/test.txt"];
NSString *mystring = [NSString stringWithContentsOfURL:myurl encoding:NSUTF8StringEncoding error:&error];
newtext.text = mystring;
All is well!
Upvotes: 1
Reputation: 9620
It looks like you have {}'s around the void in awakeFromNib they should be ()'s
Upvotes: 1