如何使用SDK /以编程方式在iPhone上获取AppID?

时间:2022-08-25 07:52:34

I want to send the AppID as a HTTP URL parameter for all web-service requests, but I do not know how to get the AppID on iPhone programmatically. Does Apple provide any API to obtain the AppID?

我想将AppID作为所有Web服务请求的HTTP URL参数发送,但我不知道如何以编程方式在iPhone上获取AppID。 Apple是否提供任何API来获取AppID?

2 个解决方案

#1


23  

I think it may be possible to access it in a different way, but you should be able to read it from your info.plist:

我认为可能以不同的方式访问它,但您应该能够从info.plist中读取它:

NSString* appID = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];

#2


3  

NSString *appID = [[NSBundle mainBundle] bundleIdentifier];

#1


23  

I think it may be possible to access it in a different way, but you should be able to read it from your info.plist:

我认为可能以不同的方式访问它,但您应该能够从info.plist中读取它:

NSString* appID = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];

#2


3  

NSString *appID = [[NSBundle mainBundle] bundleIdentifier];