开发者

How to prevent need for rebuilding app after changing Language/Region

开发者 https://www.devze.com 2023-01-27 19:28 出处:网络
The issue happens at XCode>\'Build and run\', not when running it in \'Instruments > Leaks\'. So it seems an issue with Xcode.

The issue happens at XCode>'Build and run',

not when running it in 'Instruments > Leaks'. So it seems an issue with Xcode.

If that is the case, I don't mind doing an extra rebuild.

However, if issue will also happen after app is posted in iTunes app store,

and customer installs the app in her device,

she would have to reinstall the app every time she changes language/region.

(needles to say, that would not be acceptable).

Is this issue:

a) just in Xcode (not in app store)?

b) not experienced by other developers, so likely is a bug in the app ? or

c) likely to surface even when app is installed by downloading from app store?

If 'b' or 'c', any ideas how to fix it?

----------------Steps to reproduce issue-----------------

During development:

1) Do a Xcode>'Build and run', verify app works as expected (in either simulator or device);

2) Change Language and Region (in the iPhone's 'Settings>General>International')

3) Verify:

-Console shows the non-informative error:

Program received signal: “SIGKILL”.

-App crashes in the background,

-Clicking app's icon icon no longer launches the app

(apps' default screen displays for a second, then crashes)

4) Do another 'Build and run'

5) verify now app launches and works well

(in the new language and region as expected. So app's localization strings etc work ok).

6) Do a 'Run with Performance Tool > Leaks开发者_开发知识库'

7) Change Language and Region (in the iPhone's 'Settings')

8) verify no issue.

That is:

Instruments tracking interrupts (no crashes in app or in tool), and

user can relaunch the app in iPhone as usual (steps 3 and 4 are eliminated).


I have seen a similar behavior. Between step three and five you might want to try a "stop debugging" in Xcode and skip the rebuild.

I can change the language on the device and then use the app with the newly chosen language without doing a new build, but I must press the stop button in Xcode first.


SOLUTION: Issue was in the app.
It was storing a localized value in .plist and using that value for comparison.
When language was changed, the value in .plist remained in the old language, so comparison (with value in new language) failed.
Fixed by using language-independent values in .plist and comparison.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号