【发布时间】:2012-08-10 19:38:43
【问题描述】:
如何在#define 语句中放置对象,如下所示:
#define PlacesURL @"https://maps.googleapis.com/maps/api/place/search/xml?location=34.0522222,-118.2427778&radius=500&types=**bar**&sensor=false&key=MyAPIKey"
所以,代替 bar 我想做类似 %@ 的操作,但不确定如何存储 %@ 对象。另外,我将在哪里存储对象 - 在#define 指令上方?我想存储酒吧、餐馆、咖啡店等...以便通过 iOS 应用进行 Google Places Api 搜索。
【问题讨论】:
-
你不能使用:[NSString stringWithFormat: PlacesURL, theTypeString];如果您将 bar 替换为 %@
标签: ios objective-c iphone c-preprocessor