检测AppStore的安装iOS应用 [英] Detect AppStore installation of iOS app

查看:232
本文介绍了检测AppStore的安装iOS应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的应用程序来实现自定义日志记录。

I need to implement a custom logging in my app.

要做到这一点我需要检测如果应用程序的当前版本已经从App Store安装或从X code运行或者是TestFlight版本。

To do this i need to detect if the current version of the app has been installed from the app store or is running from xcode or is a TestFlight version.

有不同的应用从安装源取决于什么?

There is something different in the app depending from the installation source?

我不希望有东西在开发环境中的不同。

I don't want to have something different in the development environment.

推荐答案

您可以在那里通过从应用程序包中的embedded.mobileprovision文件读取获得一部分的方式:

You can get part of the way there by reading in the embedded.mobileprovision file from the application bundle:

NSString *provisionPath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];

如果不存在,你是在一个应用程序商店的构建。

If that does not exist, you are in an app store build.

如果它确实存在,你需要弄清楚你的调试和临时调配配置文件之间存在差异,并寻找以确定哪些构建你在

If it does exist, you need to figure out some difference between your debug and ad-hoc provisioning profiles, and look for that to determine which build you are in.

由于X code自动应用程序在调试配置调试标志设置,未在发布(这是默认用于即席版本)设置,你可能会更好在禁用日志记录应用商店的建立和确定采伐基础上,DEBUG宏标志的水平。

Because XCode automatically sets up applications with a "DEBUG" flag in the Debug config, that is not set in Release (which is used by default for AdHoc builds), you may be better off disabling logging in an app store build and determining the level of logging based on the DEBUG macro flag.

这篇关于检测AppStore的安装iOS应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆