본문 바로가기
개발/Unity

Unity)iOS) AppStore App infomation(Version,ScreenShotUrls, Store data, BundleID, Price ..)

by 테샤르 2022. 6. 16.

 AppStore App infomation(Version,ScreenShotUrls, Store data, BundleID, Price ..)

AppStore 에서 상용 서비스중인 앱에 대한 정보는 URL을 통해서 가져올수 있다.

App Store에서 Version정보를 가지고오게되면 현재 버전과 체크해서

AppStore에 최신 버전이 있는지(업데이트)를 확인할수 있다.

 

반응형

개발자면 번들정보를 아는 방법은 Appstore Connect의 

[AppStore]- [App 선택] -[일반정보]- [앱 정보]에서 확인이 가능하다.

//다운로드 URL의 id를 가지고 확인하는 방법
"https://itunes.apple.com/lookup?id="다운로드 URL 뒤의 ID"


//Bundle ID를 아는 경우
"https://itunes.apple.com/lookup?bundleId="번들ID"

정보를 알고싶은 앱의 번들ID를 포함해서 URL을 하게되면 다음과 같이 정보가 노출된다.

테스트로 TestFlight의 다운로드 주소를 보면 다음과 같은데 JSON 형태로 데이터를 준다.

https://itunes.apple.com/lookup?id=899247664

 

JSON Parser 일부 캡쳐

보게되면 여러가지 정보를 알수있다. Unity 에서는 해당 URL을 호출로 정보를 받아오면 된다.

반응형

 

 private void CheckAppstoreNewVersion()
    {
        System.UriBuilder defaultUri = new System.UriBuilder("https://itunes.apple.com/lookup?bundleId=");
        defaultUri.Query += "찾을번들ID";
        StartCoroutine(GetJsonText(defaultUri.Uri.ToString(),
            (success,result) =>
            {
                if (success == false)
                {
                    Debug.LogError($"[WWW] :<color=white>Error Url ::{defaultUri.Uri.ToString()}</color>\n Result ::<color=red>{result}</color>");
                    return;
                }
                Debug.LogVerb($"[WWW] [{success}] - iOS Version :{result}");
            }));
    }

    [Obsolete]
    private IEnumerator GetJsonText(string _url, System.Action<bool, string> _result)
    {
        Debug.LogVerb($"[WWW] URL : <color=white>{_url}</color>");
        using (UnityEngine.Networking.UnityWebRequest www = UnityEngine.Networking.UnityWebRequest.Get(_url))
        {
            yield return www.Send();

            try
            {
                if (www.isNetworkError || www.isHttpError)
                {
                    _result.Invoke(false, www.error);
                }
                else
                {
                    var json = MiniJSON.Json.Deserialize(www.downloadHandler.text);
                    MiniJSON.JsonDictionary jsonDictionary = json.GetList("results")[0];
                    _result.Invoke(true, jsonDictionary.GetString("version"));
                }
            }catch (Exception e)
            {
                _result.Invoke(false, e.ToString());
            }
            finally{
            }
        }
    }
    #endregion

 

★☆☆☆☆

 

반응형

댓글