Getting Started with iOS Development Part5:iOS Scripting Advanced iOS scripting

Advanced iOS scripting

Determining Device Generation

Different device generations support different functionality and widely varying performance. You should query the device for its generation and decide which functionality should be disabled to compensate for slower devices.

You can retrieve device generation by accessing the iPhoneSettings.generation property. Generation can be one of the following:

  • iPhone
  • iPhone3G
  • iPhone3GS
  • iPhone4
  • iPodTouch1Gen
  • iPodTouch2Gen
  • iPodTouch3Gen
  • iPodTouch4Gen
  • iPad1Gen

You can find more information about different device generations, performance and supported functionality in iPhone Hardware Guide.

Device Properties

There are a number of device specific properties that you can access:

  
iPhoneSettings.uniqueIdentifierUnique device identifier.
iPhoneSettings.nameUser specified name for device.
iPhoneSettings.modelIs it iPhone or iPod Touch?
iPhoneSettings.systemNameOperating system.
SystemInfo.operatingSystemOperating system version.


Anti-Piracy Check

It is not uncommon for pirates to hack applications from AppStore by removing Apple DRM protection and redistributing them for free. Unity iOS comes with anti-piracy check which allows you to determine if your application was altered after it was submitted to AppStore.

You can check if your application is genuine (not-hacked) by accessing iPhoneUtils.isApplicationGenuine property. If this property returns false you're free to notify user that he is using hacked application or you can disable access to some functions of your application.

Note: accessing iPhoneUtils.isApplicationGenuine property is reasonably expensive operation and you should never do it on a frame-to-frame basis.

Vibration Support

You can trigger iOS vibration by calling iPhoneUtils.Vibrate. However iPod Touch devices lack vibration hardware and will just ignore this call.

Standard Assets

"Standard Assets" is a folder with special meaning (same as "Plugins" and "Editor) and its content is compiled before all other scripts. You should keep your scripts in folders without special name.

转载于:https://www.cnblogs.com/pengyingh/articles/2339994.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值