ECGraph not working on device, but works on simulator

后端 未结 2 424
不思量自难忘°
不思量自难忘° 2021-01-24 18:58

is there any reason why ECGraph would run fine on the simulator, but yet give me this error when i run it on my device:

 2012-08-24 01:57:18.543 Portfolio[3538:9         


        
2条回答
  •  心在旅途
    2021-01-24 19:00

    Your device is using a different Region Format than your simulator.

    If you match those (in Settings -> General -> International), then they should show the same result. In my case, when doing this, they both failed, but the simulator didn't give the same log as the device so I nearly missed it.

    I assume you are using an NSDateFormatter to format some string-date to NSDate as I was. In that case you have to make sure that this won't depend on what kind of region the phone is, and set the solution to always be the same, whereever you are.

    [df setLocale:([[NSLocale alloc] initWithLocaleIdentifier:@"en_UK"])];
    // df being the NSDateFormatter-object
    

    This tells the formatter to format using UK standards, which was needed in my case. Enter your needed country code, i.e en_US etc.

    Sti

提交回复
热议问题