The ModMyTM Family of Sites:
ModMyMotoModMyiModMyGphone





 
 
Register or Connect with Facebook

Discuss AppStore Apps | Browse / Search Cydia | MMi Cydia Stats




  Apple, iPhone & iPad Forums, Mods, Guides, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 06-27-2008, 11:55 AM
celebi23's Avatar
What's Jailbreak?
 
Join Date: Jun 2007
Device + Firmware: iPod Touch 2.0 ;)
Operating System: Mac OS X Leopard v. 10.5.2
Posts: 21
Thanks: 3
Thanked 0 Times in 0 Posts
Got some questions about urlString...

I've got two problem left with my app that I can't figure out. Looked through all of the documentation & can't seem to find the answer.

1) Can't search more than 1 word queries. Here's the code that I have for searching a site

Code:
- (void)searchBarTextDidEndEditing:(UISearchBar *)mySearchBar
{
	//•• start your search!
	UIApplication *app = [UIApplication sharedApplication];
	NSString *nameString = self.mySearchBar.text;
	
	NSString *urlString = [NSString stringWithFormat:@"Site that I am searching", nameString];
	NSURL *url = [NSURL URLWithString:urlString];
	
	[app openURL:url];
}
When I emailed Apple's Dev Tech Support, they said
Quote:
I think you might need to precent-escape all spaces when constructing the URL for searching (%20) should be replaced by the space. There are APIs in NSURL
and NSString that help you do this.
I looked all through any documentation relating to NSURL & NSString & couldn't find anything related to that.

2) And when I do have a valid query entered, any other buttons on the app, like a button to the "About" page, initializes the search process.

Apple Dev Tech Support suggested this
Quote:
Set some break points in your code and find out who is starting the search.
How exactly would I do that? Any help relating to either problem would be greatly appreciated
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote

Tag Cloud
  #2  
Old 06-28-2008, 01:34 PM
NetMage's Avatar
Developer
 
Join Date: Aug 2007
Device + Firmware: iPhone 2.2.0
Operating System: Windows XP / OS X
Location: Virginia
Posts: 1,236
Thanks: 45
Thanked 203 Times in 162 Posts

You should look at NSString stringByAddingPercentEscapesUsingEncoding: to convert the spaces and other characters illegal in URLs (such as ampersand) into their percent equivalents.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
Reply

  Apple, iPhone & iPad Forums, Mods, Guides, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion

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



Go to Top
ModMyI

All times are GMT -6. The time now is 04:04 PM. Powered by vBulletin® Version 3.8.4
If you need Dedicated Server Hosting, you should check out SingleHop. | Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0
Owned and Operated by ModMy, LLC Copyright © 2007-10. All rights reserved.

iPhone News / iPhone Forums / Apple News / Apple Forums / iPad News / iPad Forums / Cydia Hosting /
RSS / Contact Us / / Top