我想在 iOS 应用程序中获取 Unity 广告的统计信息。 Unity为此提供了一个API,但是他们声明
"The statistics server always requires signed URLs and will not work if accessed without a valid signature."
什么是签名 URL,我应该如何访问服务器?正常的 NSURLRequest 不起作用,我收到错误消息:
{"error":"身份验证错误","responseCode":500,"status":"error"}
这是我正在使用的代码(以这种方式发出请求适用于其他 api,但不适用于统一广告)
- (IBAction)Buttonid)sender {
// Create the request.
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString"https://gameads-admin.applifier.com/stats/acquisition-api?apikey=979c4e733ccd85a1eaef74e28f9dc1742d5fa5a2b3518fe10825aa13caf18185"]];
// Create url connection and fire request
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
}
您是否在请求中将您的 api key 作为 GET 参数发送?
api?apikey=APIKEY
https://unityads.unity3d.com/help/Documentation%20for%20Publishers/Statistics-API-for-monetisation
In order to use the Unity Ads Statistics API, you need to get the API key from the Unity Ads Admin Panel. The API key is located in the Account Settings page.
The API key needs to be placed in the authentication request to the apikey HTTP GET parameter.
For example curl -L "http://gameads-admin.applifier.com/stats/acquisition-api?apikey=APIKEY" will directly output the file to the console.
更新
如果您提供了正确的 API KEY,您的设置似乎有问题(顺便说一下,您不应该在此处发布)。我在终端中执行了您的示例。
➜ ~ curl -L "http://gameads-admin.applifier.com/stats/acquisition-api?apikey=YOUR_API_KEY" {"error":"Authentication error","responseCode":500,"status":"error"}%
然后我运行了我们的一个游戏并得到了不同的结果
➜ ~ curl -L "http://gameads-admin.applifier.com/stats/acquisition-api?apikey=OUR_HIDDEN_API_KEY" Date,Country code,Country tier,started,views,clicks,installs,spend
关于ios - 服务器需要签名 URL (Unity Ads API),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34568778/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |