Learn, Share, Build

October 12, 2017, at 5:24 PM

I need to make some changes to my app but only for iPhone X.

The app is Apache Cordova based (with Ionic framework).

Is there a cordova plugin to detect the iPhone X? If the answer is no, which is the best method to know if the user has an iPhone X in javascript?


Answer 1

Check: var deviceInformation = ionic.Platform.device();

From Ionic bundle.js

     * @ngdoc method
     * @name ionic.Platform#device
     * @description Return the current device (given by cordova).
     * @returns {object} The device object.
    device: function() {
      return window.device || {};

Also check cordova-plugin-device


device.cordova       // returns CDV_VERSION
 device.platform     // always returns iOS
 device.manufacturer // always returns  Apple
 device.isVirtual    // not relevant

This plugin calls CDVDevice.m -> UIDevice so if you still cannot fetch iPhone X worth to find the way how to detect it in Obj-C and change CDVDevice.m.

Also check this QA: iOS devices return different format device model, why?

Learn, Share, Build

Learn, Share, Build

I have a call in a method that i want to test like this:

Learn, Share, Build

Learn, Share, Build

How to identify which PHP script that executed the exec or shell_exec command

Learn, Share, Build

Learn, Share, Build

i want to compare two values in one php array but the code stops when i compare even when the conditions is true i want to know how can i compare the two values here is my code :

Learn, Share, Build

Learn, Share, Build

Is it possible in php not to display "Parse" error on a web page (more like hiding all error including parse error on a production environment)?