Strange Things: UITextView Save To Plist

Discussion in 'iPhone/iPad Programming' started by JoshAK, Mar 9, 2009.

  1. macrumors newbie

    Joined:
    Aug 12, 2008
    #1
    When I am saving data form a UITextView to a plist the data is saved except the last letter typed into the UITextView. I'm using:

    Code:
    NSMutableArray *array = [[NSMutableArray alloc} init];
    [array addObject:objectname];
    [array addObject:objectname2];
    [array addObject:objectname3];
    //ect
    [array writeToFile:[self noteFile1] atomically:YES];
    [aaray release];
    
    Everything is saved except the last charter in the text field. Is the a bug or does someone else know the reason?

    Thanks,

    Josh
     
  2. macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #2
    Have you checked the content of the array to ensure that all characters are being passed into it in the first place?

    Also, I assume this typo isn't in the actual code:

    Code:
    [[NSMutableArray alloc} init];
     
  3. thread starter macrumors newbie

    Joined:
    Aug 12, 2008
    #3
    Yes that is a typo. What is the best way to check the content of the array?
     
  4. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Set a breakpoint and then examine the array in the Debugger.
     
  5. thread starter macrumors newbie

    Joined:
    Aug 12, 2008
    #5
    Would you use an NSLog()?
     
  6. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    That's do-able. But there's nothing like stopping the code at a particular point and examining the stack trace, variable values, etc. The Debugger is a powerful tool built into Xcode. Take advantage of it.
     

Share This Page