「Unity/Csharp/アプリ評価」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==サンプル== <pre> using System.Collections; using System.Collections.Generic; using UnityEngine; #if UNITY_IOS using System; using UnityEngine.iOS; using System.Run...」) |
(→サンプル) |
||
行1: | 行1: | ||
==サンプル== | ==サンプル== | ||
+ | 使用方法 | ||
+ | Review review = new Review(); | ||
+ | review.Open(); | ||
+ | |||
+ | Assets/Plugins/iOS/ReviewPlugin.mm | ||
+ | <pre> | ||
+ | #import <StoreKit/StoreKit.h> | ||
+ | extern "C" { | ||
+ | void RequestReview(){ | ||
+ | [SKStoreReviewController requestReview]; | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | review.cs | ||
<pre> | <pre> | ||
using System.Collections; | using System.Collections; | ||
行34: | 行49: | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
==参考== | ==参考== | ||
http://kan-kikuchi.hatenablog.com/entry/RequestReview | http://kan-kikuchi.hatenablog.com/entry/RequestReview |
2018年3月31日 (土) 19:47時点における版
サンプル
使用方法
Review review = new Review(); review.Open();
Assets/Plugins/iOS/ReviewPlugin.mm
#import <StoreKit/StoreKit.h> extern "C" { void RequestReview(){ [SKStoreReviewController requestReview]; } }
review.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; #if UNITY_IOS using System; using UnityEngine.iOS; using System.Runtime.InteropServices; #endif public class Review { #if UNITY_IOS [DllImport ("__Internal")] private static extern float RequestReview(); #endif public void Open () { string appleId = "1357901xxx"; #if UNITY_ANDROID string url = "market://details?id=" + Application.identifier; Application.OpenURL(url); #elif UNITY_IOS Version iosVersion = new Version(Device.systemVersion); Version minVersion = new Version("10.3"); if (iosVersion >= minVersion) { RequestReview(); } else { string url = "itms-apps://itunes.apple.com/jp/app/id" + appleId + "?mt=8&action=write-review"; Application.OpenURL(url); } #endif } }
参考
http://kan-kikuchi.hatenablog.com/entry/RequestReview