ios - 服务器需要签名 URL (Unity Ads API)
<p><p>我想在 iOS 应用程序中获取 Unity 广告的统计信息。 Unity为此提供了一个API,但是他们声明</p>
<blockquote>
<p>"The statistics server always requires signed URLs and will not work
if accessed without a valid signature."</p>
</blockquote>
<p>什么是签名 URL,我应该如何访问服务器?正常的 NSURLRequest 不起作用,我收到错误消息:
<code>{"error":"身份验证错误","responseCode":500,"status":"error"}</code></p>
<p>这是我正在使用的代码(以这种方式发出请求适用于其他 api,但不适用于统一广告)</p>
<pre><code>- (IBAction)Button:(id)sender {
// Create the request.
NSURLRequest *request = ];
// Create url connection and fire request
NSURLConnection *conn = [ initWithRequest:request delegate:self];
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您是否在请求中将您的 apikey 作为 GET 参数发送? </p>
<p><code>api?apikey=APIKEY</code></p>
<p> <a href="/image/nPKdE.png" rel="noreferrer noopener nofollow"><img src="/image/nPKdE.png" alt="API"/></a> </p>
<hr/>
<p> <a href="https://unityads.unity3d.com/help/Documentation%20for%20Publishers/Statistics-API-for-monetisation" rel="noreferrer noopener nofollow">https://unityads.unity3d.com/help/Documentation%20for%20Publishers/Statistics-API-for-monetisation</a> </p>
<blockquote>
<p>In order to use the Unity Ads Statistics API, you need to get the <strong>API key</strong> from the Unity Ads Admin Panel. The API key is located in the Account Settings page.</p>
<p>The API key needs to be placed in the authentication request to the apikey HTTP GET parameter.</p>
<p>For example curl -L "<a href="http://gameads-admin.applifier.com/stats/acquisition-api?apikey=APIKEY" rel="noreferrer noopener nofollow">http://gameads-admin.applifier.com/stats/acquisition-api?apikey=APIKEY</a>" will directly output the file to the console.</p>
</blockquote>
<hr/>
<p>更新</p>
<p>如果您提供了正确的 API KEY,您的设置似乎有问题(顺便说一下,您不应该在此处发布)。我在终端中执行了您的示例。 </p>
<blockquote>
<p>➜ ~ curl -L "<a href="http://gameads-admin.applifier.com/stats/acquisition-api?apikey=YOUR_API_KEY" rel="noreferrer noopener nofollow">http://gameads-admin.applifier.com/stats/acquisition-api?apikey=YOUR_API_KEY</a>"
{"error":"Authentication error","responseCode":500,"status":"error"}% </p>
</blockquote>
<p>然后我运行了我们的一个游戏并得到了不同的结果</p>
<blockquote>
<p>➜ ~ curl -L "<a href="http://gameads-admin.applifier.com/stats/acquisition-api?apikey=OUR_HIDDEN_API_KEY" rel="noreferrer noopener nofollow">http://gameads-admin.applifier.com/stats/acquisition-api?apikey=OUR_HIDDEN_API_KEY</a>"
Date,Country code,Country tier,started,views,clicks,installs,spend</p>
</blockquote></p>
<p style="font-size: 20px;">关于ios - 服务器需要签名 URL (Unity Ads API),我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/34568778/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/34568778/
</a>
</p>
页:
[1]