HomeiOS Developmentgoal c - How do I get an IOS time zone?

goal c – How do I get an IOS time zone?


After I go to the iPhone settings when my app is operating, change the time zone and are available again to the app, I need to reset the time to the modified time zone. However I at all times get the identical time zone worth again. (Possibly the default time zone?)

    NSCalendar *calendar = [NSCalendar currentCalendar];
    
    [NSTimeZone resetSystemTimeZone];
    //NSTimeZone *deviceTimeZone = [NSTimeZone localTimeZone];
    NSTimeZone *deviceTimeZone = [NSTimeZone systemTimeZone];
    [calendar setTimeZone:deviceTimeZone];

Nonetheless, once I obtained the time zone with the code above, the return values for localTimeZone and systemTimeZone had been the identical, and once I tried it on my iPhone, it at all times returned a sure time zone whatever the time zone modified within the settings. The unusual factor is that the Mac Xcode simulator displays the time zone modified within the settings. How can I get the identical outcomes as Mac on my iPhone? If anybody is aware of, please assist..

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments