是否可以通过编程方式从 iOS 应用程序获取应用程序 ID?
有什么方法可以从运行的 iOS 应用程序中获取 appstore id 吗? (用于要求用户对其进行评分并提供应用商店的链接。)
Is there any way for getting appstore id from running iOS application? (For asking user to rate it and providing link to appstore.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
是的。您无法离线获取应用商店应用 ID(在 iTunes Connect 中称为 Apple ID),但您可以使用 iTunes Search Api 来请求。下载以下链接的上下文:
您将获得一个 JSON 响应,其中包含
"trackId":YOUR_APP_ID
键值。在浏览器中尝试一下!我的答案基于另一个答案: https://stackoverflow.com/a/11626157/3050403< /a>
Yes, it is. You can't get appstore app id (called Apple ID in iTunes Connect) offline, but you can request it using iTunes Search Api. Download the context of the following link:
You will get a JSON response, containing
"trackId":YOUR_APP_ID
key-value. Try it in your browser!My answer is based on the another answer: https://stackoverflow.com/a/11626157/3050403
使用
@zaheer 的评论更新答案
Use
Updating the answer with comment by @zaheer
您可以使用 Apple iTunes Link Maker 搜索您的应用程序(或任何与此相关的应用程序)并获取您的应用程序商店 URL。从那里您可以获得您的应用程序 URL,该 URL 对于您的应用程序将保持不变,并将其放入您的应用程序中。当您使用 itms:// 而不是 http:// 时,它将直接在 App Store 应用程序中直接打开
例如,如果我想使用 Twitter 应用程序 URL,链接创建者告诉我该 URL 是:
现在执行 itms技巧:
它会直接在 App Store 中打开,而不是通过 Safari 重定向到 App Store,
You can use the Apple iTunes Link Maker to search for your App (or any app for that matter) and get your App Store URL. From there you could get your App URL which will remain the same for your App and put it in your Application. When you use itms:// instead of http://, it will directly open in the App Store app directly
For example, if I wanted to use the Twitter App URL, the link maker tells me the URL is:
Now do the itms trick:
And it will directly open in the App Store than redirect via Safari then to the App Store,
您可以使用下面的功能。
注意:Apple 中没有记录此 API。
You can use this below function.
Note: This API is not documented in Apple.
这是 Vimalkumar NM 的出色答案的稍微改进版本,用于从 Apple 本身获取 App Store 跟踪 ID,已针对 Swift 5 进行更新,有两项改进:
nil
。trackID
,您需要自己构建 URL)您收到的最终 URL(当然,在非错误情况下)看起来像:
https://apps.apple.com/us/app/[app-name]/id123456789?uo=4
(请参阅此答案的底部以将该网址转换为审核网址。)
现在,要从“基本”App Store URL 转到您用于手动启动审核的 URL,您需要附加查询字符串
action=write-review
。您可以将以下扩展添加到URL
中,以一种简洁的方式支持此功能(您当然不想只将"&action=write-review"
添加到URL 的字符串版本,因为它可能包含也可能不包含查询参数!):然后您可以像这样添加以使用它:
Here's a slightly improved version of Vimalkumar N.M.'s great answer for fetching the App Store tracking ID from Apple themselves, updated for Swift 5, with two improvements:
nil
.trackID
, from which you would need to build the URL yourself)The final URL you're handed (in the non-error case, of course) will look something like:
https://apps.apple.com/us/app/[app-name]/id123456789?uo=4
(See the bottom of this answer for turning that URL into the review URL.)
Now, to go from the "base" App Store URL to the URL you'd use to manually initiate a review, you'll need to append the query string
action=write-review
. Here's an extension you can add toURL
to support this in a clean way (you certainly wouldn't want to just add"&action=write-review"
to the string version of the URL, since it may or may not already include a query parameter!):Then you can add to use it like this:
像这样获取应用程序ID
get the app id like this
对于 appId,您只需按组件分隔包标识符字符串,然后只需获取最后一个组件即可。
或者相应地处理完整字符串,但它将具有整个包标识符。
For the appId only you need to separate the bundle identifier string by components and simply grab the last component.
Or handle the full string accordingly but it will have the entire bundle identifier.