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 04-27-2010, 08:42 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 10
Rober1337 is on a distinguished road
Question Date to URL address problems...

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];
	}
}

Last edited by Rober1337; 04-27-2010 at 08:46 PM. Reason: I cleaned up the code a little. Now I just have "conflicting types for 'string'" and "Statistically allocated instance of Obj
Rober1337 is offline   Reply With Quote
Reply

Bookmarks

Tags
nsstring, url string

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: 326
21 members and 305 guests
Abidullah, baja_yu, cgokey, Domele, Duncan C, Fstuff, gbenna, givensur, guusleijsten, HowEver, iphonedevshani, jbro, JoeRCruso, mdpauley, n00b, newDev, seokwon lee, SLIC, stanny, Steven.C, WheyLabs
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,112
Posts: 402,876
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

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