Localization works with strings but not xib

Discussion in 'iOS Programming' started by 1458279, Nov 26, 2011.

  1. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #1
    I'm working thru the BNR book and doing the localization. It's setup for Xcode 3, so I went on the web and found how to setup the xib in Xcode 4.

    I ended up with 2 xib files under the original xib, one (English) and one (Spanish)

    It displayed the original xib with either lang setting. So I changed BOTH xibs and it did not show the changes...
    So I cleaned the project... still doesn't show any changes to either xib with either lang settings.
    So I closed Xcode and restarted, power downed the test device... still it doesn't show the changed xib or the spanish xib.

    The old xib had a text field 'Name' I changed it to 'English Name' and the spanish xib is 'Nombre'

    I run the program and the field is 'Name' which is not in ANY xib!

    The strings part works fine! The program converts to spanish when the lang is set.

    The only problem is the .xib is not changing, it's like it's reading a .xib from somewhere else.

    I even added a new label to one xib and it didn't change on the device or the simulator!

    Question 1: how do I stop the debugger from going into .asm code and stay only in ObjC code.

    Question 2: how can I follow the debugger into the loading of a .xib file?

    Edit: I also loaded the sample code from the book, to see how it worked. The .xib file did the same thing.

    Just checked the books sample code, when I change the .xib by adding a new label, it doesn't show on the device!
     
  2. 1458279, Nov 26, 2011
    Last edited: Nov 26, 2011

    1458279 thread starter Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #2
    Forgot the version: 4.0.1 Build 4A1006

    Edit: I checked with Finder and there are two files in both projects.

    It's like it's stuck in cache somewhere, but I've cleaned the project.
     
  3. 1458279 thread starter Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #3
    Ok, so I rebooted the mac and nothing changed.
    Deleted both .xib files and nothing changed. Without the .xib files, the program was still showing the screen from before I added the spanish lang.

    So, I added a .xib of the exact same name as the original one, and NOW it crashes.

    Really strange! It's like it was held in some cache that I had no access to. The only way I could flush it out was to delete all .xib files and replace them with a blank one...
     
  4. forum user macrumors regular

    Joined:
    Aug 28, 2008
    #4
    A1: you don't. The debugger will show the current line of executed code. If there is no source available then the debugger will show assembler.

    The trick is to set one breakpoint before and one breakpoint after such an assembler section. When the debugger leaves your source and enters into assembler you let it continue. The breakpoint you set after will catch in. I tried to use "step out" but could never make that work to my satisfaction.

    A2: I don't this this is possible. The xib is XML code and the *.m (the source) of the view where loading of the xib takes place is not public.


    With respect to your xib behaving strangely:

    Ensure you have exited the app on the simulator/device (double click home and terminate). In particular with the loading of xib I had seen strange behavior. Resetting the simulator can help to, same as deleting the app from the simulator. Sometime Xcode will compile the project and install it on the simulator but the changed nib are not pushed across.

    I found most problems when the xibs did not live in the correct directories inside the projects. That tends to be English.lproj/ for engish or es.lproj/ for Spanish.


    - Olaf
     
  5. 1458279, Nov 27, 2011
    Last edited: Nov 27, 2011

    1458279 thread starter Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #5
    Thanks for the reply, I hope they change the .asm in the debugger, should be some kinda setting for that. Step Over is what we used to use.

    On the xib's...
    I've tried everything and still nothing works, so deleted the files and will try again some other time. I really can't think of what went wrong.

    I understand the point of the book, and might try again some other time.

    The program is part of a book sample and worked perfectly up until I split the xib files.
    It might have something to do with the version I'm using, I haven't checked for updates and I think this is the 1st version 4 Xcode that was released.

    So I'm off to another part of the book :rolleyes:
     
  6. 1458279 thread starter Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #6
    Well there's clearly something goofy going on with my system. I just restarted a new project, deleted the directory in Finder and started the whole project over again... It started with 4 warnings before I wrote any code!

    It was giving warnings on line that didn't have anything on them.

    I started a new project again, this time with a new name... it didn't have the warnings.

    It's something with Xcode or my system that's not flushing things out. Things are getting stuck in memory / cache / buffer... something.
     

Share This Page