Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Sunday, September 4, 2011

XCode 4 and Localizable.strings issue

It was very annoying issue. XCode doesn't copy Localizable.strings files into app bundle. First time i used workaround: delete Localizable.strings with languages and add to project again, but when i made build for distribution i found out that Localizable.strings files are not copied in app bundle! I tried all possible and impossible combinations: remove from "Copy bundle resources" (Target\Build phases), manually add Localizable.strings into "Copy bundle resources", different "Localization native development region" strings, different place in project hierarchy, different encodings (should be UTF-16), XCode 4.2 beta, XCode 4.0 and other. It was unsuccessful. I have: correct Localizable.strings, correct instruction to copy files in "Copy bundle resources", no warnings in project. I don't have: Localizable.strings files in app bundle.

After 2 days i found solution! It was very simple:
1. goto Target\Build phases
2. click "Add build phase" button and select "Copy files"
3. select "Resources" in "Copy files" phase
4. add Localizable.strings
5. make build for distribution (Project\Archive).
5. check app folder for all Localizable.strings files - PROFIT!

:-)

Thursday, August 25, 2011

performSelector: withObject: afterDelay: issue

I have discovered interesting issue today. I have the method for updating some info:
- (void) updateObject {
  // updating code

  // schedule next updating
  [self performSelector:@selector(updateObject) withObject:nil afterDelay:4.0];
  NSLog(@"done");
}
I figured out that updateObject is called twice! Second call was made immediately after first call was finished.