summaryrefslogtreecommitdiff
path: root/platform/iphone/ios.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/iphone/ios.mm')
-rw-r--r--platform/iphone/ios.mm16
1 files changed, 16 insertions, 0 deletions
diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm
index 686422ceb2..6e986df493 100644
--- a/platform/iphone/ios.mm
+++ b/platform/iphone/ios.mm
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "ios.h"
+#include <sys/sysctl.h>
#import <UIKit/UIKit.h>
@@ -42,6 +43,21 @@ void iOS::alert(const char *p_alert, const char *p_title) {
[alert show];
}
+String iOS::get_model() const {
+ // [[UIDevice currentDevice] model] only returns "iPad" or "iPhone".
+ size_t size;
+ sysctlbyname("hw.machine", NULL, &size, NULL, 0);
+ char *model = (char *)malloc(size);
+ if (model == NULL) {
+ return "";
+ }
+ sysctlbyname("hw.machine", model, &size, NULL, 0);
+ NSString *platform = [NSString stringWithCString:model encoding:NSUTF8StringEncoding];
+ free(model);
+ const char *str = [platform UTF8String];
+ return String(str != NULL ? str : "");
+}
+
String iOS::get_rate_url(int p_app_id) const {
String templ = "itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID";
String templ_iOS7 = "itms-apps://itunes.apple.com/app/idAPP_ID";