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 12-22-2011, 10:00 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 19
francis is on a distinguished road
Default Echo a link?

i am building an app leaderboard and i have the correct variables then i still get errors so i was told to echo my link can someone guide me pls

here is the code:
Code:
NSString *udid = [[UIDevice currentDevice]uniqueIdentifier];
	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
	[defaults setObject:udid forKey:@"did"];
	[defaults setInteger:currentScore forKey:@"score"];
	[defaults setObject:currentPlayer forKey:@"name"];
	
	NSLog(@"%@,%i,%@",udid,currentScore,currentPlayer);
	
	NSString *request_url = [NSString stringWithFormat:@"http://192.168.18.8/lboard/addrank.php?did=%@&sre=%i&nme=%@&fmt=jsn",udid,currentScore,currentPlayer];
i have to echo the link~ thx
francis is offline   Reply With Quote
Old 12-23-2011, 07:50 AM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,005
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by francis View Post
i am building an app leaderboard and i have the correct variables then i still get errors so i was told to echo my link can someone guide me pls

here is the code:
Code:
NSString *udid = [[UIDevice currentDevice]uniqueIdentifier];
	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
	[defaults setObject:udid forKey:@"did"];
	[defaults setInteger:currentScore forKey:@"score"];
	[defaults setObject:currentPlayer forKey:@"name"];
	
	NSLog(@"%@,%i,%@",udid,currentScore,currentPlayer);
	
	NSString *request_url = [NSString stringWithFormat:@"http://192.168.18.8/lboard/addrank.php?did=%@&sre=%i&nme=%@&fmt=jsn",udid,currentScore,currentPlayer];
i have to echo the link~ thx
What do you mean echo your link. You mean display it to the console?

You already have an NSLog statement in the sample code you posted. Don't you know how to write an NSLog statement? If you don't, how can you possible write a full-featured game with leader boards?
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Old 12-25-2011, 07:45 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 19
francis is on a distinguished road
Default

@duncan

im sorry im just a little confused. xD


are u on? im gonna ask u something..

i have this data's on the php server composed of number,name,score,udid and datetime i want them to be seen in my app as a list.. how am i supposed to do that?? i tried something but i just get the 1st rank and it is like a sentence form..

thanks
francis is offline   Reply With Quote
Old 12-25-2011, 07:50 PM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,005
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by francis View Post
@duncan

im sorry im just a little confused. xD


are u on? im gonna ask u something..

i have this data's on the php server composed of number,name,score,udid and datetime i want them to be seen in my app as a list.. how am i supposed to do that?? i tried something but i just get the 1st rank and it is like a sentence form..

thanks
You want them "to be seen in my app as a list." What does that mean?

You need to be clear and specific, and so far your posts have been neither.

You want to show the user the information?

Something like this:

"You entered your name as 'Fred jones." Your Id number is 12345. Your score is 10,000. Your UDID is '3a3334eca425fedc3242323224f4ca'."

Or something different?

You said "as a list." What do you mean by a list?
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Old 12-25-2011, 07:57 PM   #5 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 19
francis is on a distinguished road
Default

i mean like this

1. player1 score
2. player2 score

i dont want the datetime and the udid to be seen how can i do that ill be putting them in a label.

im sorry if my questions aren't clear enough... im just a newbie... thanks for you help

Last edited by francis; 12-25-2011 at 08:03 PM.
francis is offline   Reply With Quote
Old 12-25-2011, 08:14 PM   #6 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,005
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by francis View Post
i mean like this

1. player1 score
2. player2 score

i dont want the datetime and the udid to be seen how can i do that ill be putting them in a label.

im sorry if my questions aren't clear enough... im just a newbie... thanks for you help
Do we have to play 20 questions here?

You posted code that got a single player's score, name, UDID, and other stuff, then uploaded it to a server. Originally you said you wanted to echo the link that you were sending to the server.

Now, you're saying that you want to show multiple player's scores on the screen at once. How will you get all these scores? Do you literally want to show

1. player1 score
2. player2 score

Or would "player1" and "player2" really be the player's game name, like "Bob123", or the like? If so, how would you get that information?

Would there be a small enough list of players that they would all fit on the screen at once, or do you want to show them in a scrolling list?

How is this data stored? Would read it from the server? If yes, Do you have a defined format in which it would come down from the server?

I'm about ready to give up on this thread. You need to post clear, detailed information about what you're trying to do, where the info would come from, etc.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Old 12-25-2011, 08:20 PM   #7 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 19
francis is on a distinguished road
Default

ok to make things clear.. forget about the 1st post what im asking is new

i have this code:
Code:
UILabel *label1 = [[[UILabel alloc]initWithFrame:CGRectMake(10, 60, 300, 350)]autorelease];
	label1.backgroundColor=[UIColor clearColor];
	label1.numberOfLines = 100;
	label1.textAlignment = UITextAlignmentLeft;
	[nextView addSubview:label1];
	[nextView release];
	
	
	NSDictionary *responseDictionary = [[request responseString]JSONValue];
	NSArray *dataArray = [responseDictionary objectForKey:@"data"];
	NSDictionary *entry = [dataArray objectAtIndex:0];
	NSString *entryNum = [entry objectForKey:@"num"];
	NSString *entryDid = [entry objectForKey:@"did"];
	NSString *entryName = [entry objectForKey:@"name"];
	NSString *entryScore = [entry objectForKey:@"score"];
	NSString *entryDate = [entry objectForKey:@"datetime"];
	
	for(NSString *value in [entry allKeys]) {
		NSLog(@"found key %@",value);
		label1.text = [value stringByAppendingFormat:@"%@,%@,%@,%@,%@",entryNum,entryDid,entryName,entryScore,entryDate];
		
	}
now when i execute i get the values on the screen but in a sentence like form .. like 1,player1,hkdflkgj09094,1000,12-12-11

something like that. what i want is to get the values of lets say 5 players then their data's be posted something like:

1. Player1 5000
2. Player2 3000
3. Player3 2000
4. Player4 1000
5. Player5 500

like that? i dont want the datetime and udid be posted...

im sorry for my questions please bear with me.

Last edited by francis; 12-25-2011 at 09:28 PM.
francis is offline   Reply With Quote
Reply

Bookmarks

Tags
ios, iphone

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: 392
13 members and 379 guests
7twenty7, AppsBlogger, Creativ, Dalia, David-T, Duncan C, HemiMG, heshiming, LunarMoon, Murphy, pbart, teebee74, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

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