Author Topic: UI Input Undo crashes on ios  (Read 10003 times)

UndeadMatt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
UI Input Undo crashes on ios
« on: August 19, 2014, 07:08:29 PM »
I set up a UIInput field with ASCIICapable.  On iOS, when I switch to the numbers page and hit the "undo" button, my app crashes. Any idea what's going on here?



ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #1 on: August 20, 2014, 03:10:20 PM »
I'd suggest bug reporting it to Unity. Anything related to crashes is a Unity issue. Worst NGUI can do is cause a null exception.

brusnell

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #2 on: September 11, 2014, 06:10:40 PM »
I'm seeing something very similar.  I currently use a UI Input component that allows a maximum of 20 characters.  When I enter text that contains < 20 characters, the undo operation performs as expected.  When I selected undo at the maximum character count, the app crashes, and immediately exits back to the OS.  Is this still a Unity issue, or, does it have to do with the code that handles the maximum character count?

@UndeadMatt Any update on your issue?  Were you able to fix it?  How so?

Thanks.

nitzamc

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #3 on: September 11, 2014, 08:13:49 PM »
until it is fixed(or you find a solution) i would suggest to add a little script where it allows to input (maximum-1) for no crashes

brusnell

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #4 on: September 11, 2014, 08:22:42 PM »
Hi,

Thanks for the reply.  Can you elaborate?  What do you mean by "allows to input (maximum-1)"?  Are you saying that I should implement my own version of UI Input?  I'm not entirely fond of this idea, but in order to create a custom, working version, I need to know what the source of the crash is.  Once I've narrowed that down, I can figure out how to proceed.  Any ideas on what is causing the crash?

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #5 on: September 12, 2014, 04:08:41 AM »
Where does the crash occur? Do you have a stack trace or error log?

brusnell

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #6 on: September 15, 2014, 07:13:06 PM »
Sorry for taking so long to reply.  Yes, I have an error message:

2014-09-15 17:06:43.880 <appnamehere>[1202:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSBigMutableString substringWithRange:]: Range {20, 1} out of bounds; string length 20'
*** First throw call stack:
(0x2f4e6fd3 0x3a0b0ccf 0x2f4e6f15 0x2fe13721 0x31eb747d 0x323201a9 0x2ff083eb 0x2ff0727b 0x31f7ce0f 0x31f19b29 0x31f19a69 0x31e2105f 0x31ed3377 0x31d826f5 0x31cfb55b 0x2f4b22a5 0x2f4afc49 0x2f4aff8b 0x2f41af0f 0x2f41acf3 0x34340663 0x31d6616d 0xea96c 0xea848)
libc++abi.dylib: terminating with uncaught exception of type NSException

Where <appnamehere> is a placeholder for the actual app name.
Also, we limit the length of UI Input string to be 20 characters.

Hope this helps.
Thanks again.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #7 on: September 16, 2014, 09:24:37 AM »
Hmm yeah, that doesn't explain much, unfortunately. That just tells me that the problem is on the Objective-C side, and doesn't explain why or what's happening.

brusnell

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #8 on: September 16, 2014, 11:34:50 AM »
You'll have to forgive me here, as I'm new to both C# and Unity, but is this something I should take up with Unity in their forums?  If so, what can I add to this error message, to help them figure out what's going on?  I'm thinking that simply saying "I'm using UI Input in NGUI" is too vague.  Is there anything more specific I can add here, or, is this the best I can show them?  Thanks again.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #9 on: September 17, 2014, 11:35:20 AM »
Just submit a bug report with the steps to reproduce (Help -> Bug Report). Crash cases get priority. Explain what happens and how to reproduce, and they'll take care of the rest.

brusnell

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #10 on: September 17, 2014, 11:40:30 AM »
Great, thanks.

lorensoth

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #11 on: October 24, 2014, 04:34:32 AM »
Hello,

I thiiiiink i have the same problem and i think it is not the Unity's bug. Here i'm writing the steps to reproduce:
(Using the 3.7.0 version)

1. Create an UIInput Ngui Gameobject.
2. Set Validation property of UIInput as username so the player wont be able type ^+%+^%%& .etc chars.
3. Plug in your iDevice and Build and export to Xcode project OR Press Ctrl + B directly see on the device.
4. Type several characters, ending with a symbol. (the symbol character is not shown but i think it counts for Undo functionality )
5. Press the ".?123" button.
6. Press "Undo".
7. and Crash.

If you don't write symbol characters it is working fine.
If this is resolved in the later version btw sorry for the trouble. Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #12 on: October 25, 2014, 02:26:07 PM »
As I said, anything related to crashes is a Unity issue. The worst NGUI can do is cause a null exception. I don't know how iOS's undo works, but what NGUI does is simply changes the text of the TouchScreenKeyboard when a character is invalid and gets removed from the string.

lorensoth

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #13 on: October 25, 2014, 03:50:20 PM »
Hmmmm thanks, i think i got it, maybe unity still writing these invalid characters as user types them with the virtual keyboard to a another buffer string kinda something anddddddddd sooooo these 2 strings maybe non identical (the one is edited by NGUI and the one created with pressing the buttons of the virt. keyboard) and depending on the Undo functionality, it crashes somewhere. Well, heh just a guess of course. Ok thanks.

tomo_tochi

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: UI Input Undo crashes on ios
« Reply #14 on: January 14, 2015, 09:00:50 PM »
Redirected and continued in Unity Forum:
http://forum.unity3d.com/threads/ui-input-undo-crashes-on-ios.291167/
----
Workarounds: (lorensoth's case)
Simply removing the validation property and letting your program check for non-usable characters work.
----