Xcode Error on Simulator: MGIsDeviceOneOfType is not supported on this platform

后端 未结 18 1972
执笔经年
执笔经年 2020-12-02 10:55

I have a very simple application with a single view, containing several UILabels. Upon running in Simulator, the Xcode console returns the error:

libM

相关标签:
18条回答
  • 2020-12-02 11:32

    This error will only occur when testing/debugging on simulators.

    The newer the simulator the better.

    Case: I run simulator iPhone 8 plus I got this message in the debugger.

    Solution: I changed to a newer simulator no error message in the debugger.

    0 讨论(0)
  • 2020-12-02 11:33

    If you have fonts provided by the app, you need to add to Info.plist And check if the file have the Target Membership selected

    0 讨论(0)
  • 2020-12-02 11:34

    For me, with the simulator in question in focus, I selected Hardware->Erase all content and settings.

    After the simulator restarted, launching my app worked again, as expected.

    0 讨论(0)
  • 2020-12-02 11:34

    I got this error, when trying to read a json file which is inside my project and it returned nil, due to that i got this error.

    I got nil because of some spelling mistake in the font name, that json file was holding the font names, after copy pasting the font name i got data and the error fixed.

    I tried allmost all of the solutions given above, nothing worked, So debug with patience, you will get to know which is causing this error and in some bad time xcode will play in our life :)

    0 讨论(0)
  • 2020-12-02 11:35

    MobileGestalt

    The libMobileGestalt.dylib provides a central repository for all of the iOS's properties. It can be analogous to OS X's Gestalt, which is part of CoreServices. OS X's Gestalt is documented for example Gestalt Manager and has been deprecated as of 10.8. MobileGestalt is entirely undocumented by Apple as it is a private library.

    MobileGestalt allows for the testing of system properties that may or may not be compatible on different simulators.

    Quite a few system processes and apps in iOS rely on MobileGestalt, which is located at /usr/lib/libMobileGestalt.dylib. It's more of a basic library, but its exposed APIs follow the Apple framework conventions and uses the MG API prefix for example MGIsDeviceOneOfType.

    If you look for MobileGestalt on the iOS filesystem you won't find it - like all private frameworks and libraries, it has been prelinked into the /System/Library/Caches/...etc. If you like hacking and pen-testing then you can use tools to extract it.

    MobileGestalt provides plenty of information - around 200 or so queries - on various aspects of the system. Here are a few.

    libMobileGestalt.dylib
    //Answers to MG queries
    
    MGCopyAnswer(@"5MSZn7w3nnJp22VbpqaxLQ");
    MGCopyAnswer(@"7mV26K/1a+wTtqiunvHMUQ");
    MGCopyAnswer(@"BasebandAPTimeSync");
    MGCopyAnswer(@"BasebandPostponementStatus");
    MGCopyAnswer(@"BasebandPostponementStatusBlob");
    MGCopyAnswer(@"BasebandSecurityInfoBlob");
    MGCopyAnswer(@"BasebandStatus");
    MGCopyAnswer(@"BuildVersion");
    MGCopyAnswer(@"CoreRoutineCapability");
    MGCopyAnswer(@"DeviceClass");
    MGCopyAnswer(@"DeviceClassNumber");
    MGCopyAnswer(@"DeviceName");
    MGCopyAnswer(@"DeviceSupports1080p");
    MGCopyAnswer(@"DeviceSupports720p");
    MGCopyAnswer(@"DiskUsage");
    MGCopyAnswer(@"GSDeviceName");
    MGCopyAnswer(@"HWModelStr");
    MGCopyAnswer(@"HasBaseband");
    MGCopyAnswer(@"InternalBuild");
    MGCopyAnswer(@"InverseDeviceID");
    MGCopyAnswer(@"IsSimulator");
    MGCopyAnswer(@"MLBSerialNumber");
    MGCopyAnswer(@"MaxH264PlaybackLevel");
    MGCopyAnswer(@"MinimumSupportediTunesVersion");
    MGCopyAnswer(@"PasswordConfigured");
    MGCopyAnswer(@"PasswordProtected");
    MGCopyAnswer(@"ProductType");
    MGCopyAnswer(@"ProductVersion");
    MGCopyAnswer(@"RegionCode");
    MGCopyAnswer(@"RegionalBehaviorNTSC");
    MGCopyAnswer(@"RegionalBehaviorNoPasscodeLocationTiles");
    MGCopyAnswer(@"ReleaseType");
    MGCopyAnswer(@"SIMStatus");
    

    There are hundreds more e.g. AirplaneMode, MobileEquipmentIdentifier, etc.

    MobileGestalt maintains a table of OSType selector codes. for example c:890 in the message: libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform. In this case MGIsDeviceOneOfType is a method of the MobileGestalt library.

    Instead of checking the simulator version there is a separate selector for directly querying the capabilities of the simulator. The messages most likely indicate incompatibilities between simulator versions and Xcode versions and/or unsupported APIs on the simulator.

    0 讨论(0)
  • 2020-12-02 11:35

    The regular way when strange errors happens helped:

    1) Clean project;
    2) Shut down simulator;
    3) Reinstall pods.

    Xcode 10.

    0 讨论(0)
提交回复
热议问题