So I'm making a program that accesses a specific webpage based on the current date.
My relevant .m code looks like:
Code:
- (void)viewDidLoad {
NSString *nameString = string; if ([nameString length] == 0) {
NSDate *now = [[NSDate alloc] init];
//Format the date output-er
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MM/dd/yyyy"];
NSString *string = [dateFormatter stringFromDate:now];
NSData *temporary = string;
[now release];
NSString *temp = [[NSString alloc] initWithData:temporary encoding:NSASCIIStringEncoding];
NSString *greeting = [[NSString alloc] initWithFormat:@"%@", temp];
NSString *urlAddress = "https://www.website.com/%@", greeting;
[greeting release];
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webView loadRequest:requestObj];
}
}
It looked cleaner about an hour ago... But now I'm kinda going crazy trying to transfer the current date into a regular string format so it can be added to the end of a URL string.... Please help?? I'm now getting the error: "conflicting types" and "cannot convert to pointer types" allong with my original error of: "Statistically allocated instance of Objective-C class 'NSString'"...
If you need incentive, if you fix my problem, I promise to buy an app from you the # of times it would take to get you about 5$.
EDIT:
Code:
- (void)viewDidLoad {
NSString *nameString = string; if ([nameString length] == 0) {
NSDate *now = [[NSDate alloc] init];
//Format the date output-er
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MM/dd/yyyy"];
NSString *string = [dateFormatter stringFromDate:now];
[now release];
NSString *urlAddress = "https://www.woodward.edu/mobile/index.aspx?pageaction=ViewSinglePublic&LinkID=5969&ModuleID=40&StartDate=%@", string;
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webView loadRequest:requestObj];
}
}