当前位置: 动力学知识库 > 问答 > 编程问答 >

cocoa touch - How to inject a URL to a service into an iPhone application without hard coding?

问题描述:

I've typically just used constants in the past for things like this, say

#define SERVICE_URL @"http://..."

//...

NSURL *url = [[NSURL alloc] initWithString:SERVICE_URL];

But is there a better way to do this without hard coding?

I would prefer not to ask something so trivial, but I tried many, many searches for things like "settings", "constants", "application settings in property lists", and so on, but they all seem to return things for other topics.

网友答案:

Storing these in a PLIST would just be fine. I would have a service object lazy-load this only when you need it to reduce the amount of boilerplate code.

分享给朋友:
您可能感兴趣的文章:
随机阅读: