一個變量,這是我有什麼我如何包括在NSURL iphone
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the view controller's view to the window and display.
responseData = [[NSMutableData data] retain];
results = [NSMutableArray array];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://maps.googleapis.com/maps/api/place/search/json?location=38.69747988499999,-121.3570182875&radius=9900&types=bar&sensor=false&key=fake_key"]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
return YES;
}
,並與網址我想有一個變量在那裏的位置。基本上我的應用程序越來越位置,我想落實到URL這讓我可以找到周圍的酒吧....如何將我做到這一點
我想
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the view controller's view to the window and display.
responseData = [[NSMutableData data] retain];
results = [NSMutableArray array];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://maps.googleapis.com/maps/api/place/search/json?location=%@,%@&radius=9900&types=bar&sensor=false&key=fake_key", longitude,latitude]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
return YES;
}
但它沒有工作
請從NSString的幫助
一些示例代碼; 任何機會,你會知道我爲什麼會嗎? –
你有什麼錯誤? – Sean
如何申報經緯度?如果它們被聲明爲NSNumber引用,那麼上面應該可以工作,但是如果它們是原始的浮點類型,則可能需要在格式字符串中使用%f(對於float)而不是%@ –