Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5972515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:40:07+00:00 2026-05-22T20:40:07+00:00

I have a weird problem with a bugfix for Tiny Wings. In my game

  • 0

I have a weird problem with a bugfix for Tiny Wings. In my game i use something like:

NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];      
[userDefaults setFloat:musicVolume forKey:@"musicVolume"];

for saving some preferences and the highscore table. At the end of the game when the gameover screen appears the game saves the highscores to the standardUserDefaults. It works very well until the game displayed an UIAlertView like this:

UIAlertView *alert = [[UIAlertView alloc] init];
[alert setTitle:@"Get ready!"];
[alert setDelegate:self];
[alert addButtonWithTitle:@"Ok"];
[alert show];
[alert release];

After the AlertView disappeared everytime the game save somthing to the standardUserDefaults the game lags for a while (on some devices for several seconds). This also happens after the game used an UITextField for inputting the player name. There is not any lag in the game before one of the two UIKit Elements are used but after the use of them the game lags until i restart the app. I have analysed the problem with the Performance Tools and the “I/O Activity” Instrument shows that there are hundreds of “open – read – close” accesses to the

/System/Library/Frameworks/UIKit.framework/InputModeProperties.plist

which causes the lags.

I totaly have no clue what to do. Any ideas?

Edit:
there is a thread in the apple developer forum http://devforums.apple.com/message/424374#424374 where somebody has an equal problem and it seems that it only appears with iOS 4.3. I have tested it and the lags only happens on my 4.3 devices (not on a 3.1 iPod Touch and 4.2 iPad).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:40:08+00:00Added an answer on May 22, 2026 at 8:40 pm

    EDIT

    A decent bug workaround :

    Short version: Just delay the bug-triggering calls until user is not annoyed.

    Long version:

    Since I think the issue is coming from [NSUserDefaults standardUserDefaults] call, that triggers that dirty plist-loading loop AFTER some action requesting Keyboard layouts (like an UIAlert)…

    I would suggest to call [NSUserDefaults standardUserDefaults] just one time at app loading (BEFORE any bug-causing call), and keep the returned reference in a singleton class during all app lifecycle. I don’t think the memory footprint would be huge… (I’m doing this in several apps w/o any issues). At worse the plist load*100 would be done only once at app load, and not during game.

    If the issue comes from [userDefaults setXxxx:...] calls, same workaround, you could just keep values to save in memory and set them later in userDefaults, like just before syncing them… But at the risk of losing informations if anything goes wrong, like a crash. I personally prefer to sync after each set to ensure data integrity…

    ENDOFEDIT


    The short answer : iOS4.3 bug, very few chances to find a workaround… bugreport and wait for next iOS update… WWDC in 2 weeks… 1~2 month.

    The long one:

    After looking at UIKit asssembly, here are my guesses:

    • InputModeProperties.plist contains a list of all keyboards layouts by locale.
    • UIKit use this for several things, like when showing a keyboard, to determine available keyboards layouts. (Locales…)
    • One thing is interesting, we can find some of its informations in NSUserDefaults :

      NSLog(@"%@", [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]);
      ==> {
      AppleKeyboards =     (          // I have two keyboard in preferences
         "fr_FR@hw=French;sw=AZERTY", // french  first
         "en_US@hw=US;sw=QWERTY"      // english second
      );
      ...
      
    • But these informations are not stored in apps preferences, unlike your score. (NSGlobalDomain, or more likely Separate domains for each of the user’s preferred languages)
    • So I would not be surprised a conflict (bug) exists in UIKit + NSUserDefaults causing that dirty plist loading loop.
    • Around 100 call you say? That’s something like the number of locale/layouts in the plist!

    When no keyboard is available in NSUserDefaults… (Like after synchronizing, let’s imagine a bug doing this)… UIKit could try all available keyboards to determine user one, dirtily parsing this 4.4K plist hundred times… Like when showing an UIAlertView… after a NSUSerDefault sync/change.

    Who knows? The Apple folks who has the source code 🙂

    I would not be surprised going to preferences to set a keyboard other than default US then reverting to US would solve the issue. Useless in your case, but would confirm the issue. Seen that for another 4.3 bug…

    As other people said, not using NSUserDefaults but a simple custom plist in /Documents could be a (in)decent workaround.

    Great work on Tiny Wings! 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a weird problem. i would like to delete an assembly(plugin.dll on harddisk)
I have a weird problem where I can't use the normal sizzle selector to
I have a weird problem and I would like if someone can enlighten me
I have a weird problem. I have a vector that I would like to
I have weird problem with this code: if I run it like shown below
I have a weird problem with images in visual web developer, I cant change
I have a weird problem where after setting nocheck on a foreign constraint and
I have this weird problem with setting up cookies with PHP. Everything worked fine
I have a weird problem that i can't figure out a solution for: I've
I have a weird problem, and I don't know if this is the default

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.