Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ios 7][label] App crash with text align and links #22

Open
mantonaci opened this issue Oct 8, 2013 · 11 comments
Open

[ios 7][label] App crash with text align and links #22

mantonaci opened this issue Oct 8, 2013 · 11 comments

Comments

@mantonaci
Copy link

If you set text align (in my case Ti.UI.TEXT_ALIGNMENT_CENTER) and more links app crash on iOS 7.

The application has crashed with an uncaught exception 'NSRangeException'. Reason: NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds
@dezinezync
Copy link
Contributor

You could please paste an example Label object which I can test? Also, to what type of view did you add it to(Window, View, etc)?

Cheers,
Nikh.

On Tue, Oct 8, 2013 at 8:33 PM, Michele Antonaci notifications@github.com
wrote:

If you set text align (in my case Ti.UI.TEXT_ALIGNMENT_CENTER) and more links app crash on iOS 7.

The application has crashed with an uncaught exception 'NSRangeException'. Reason: NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds

Reply to this email directly or view it on GitHub:
#22

@mantonaci
Copy link
Author

Below there is a snippet of code, in this example, the underline is not displayed.

I add it on a ScrollableView.

var string = "Cliccando su Salva, indichi di aver letto e accettato la Normative sulla privacy e le Condizioni d'uso.";
var privacyLabel = Ti.UI.createLabel({
    top : 10,
    width : 300,
    textAlign : Ti.UI.TEXT_ALIGNMENT_CENTER,
    font : {
        fontSize : 14
    },
    color : "#3C3C3C",
    text : string,
    attributedText : {
        text : string,

        attributes : [{
            text : "Condizioni d'uso.",
            color : "#fff",
            link : "http://demo.paybay.it/web/termini",
            underline : 1
        }],

        attributes : [{
            text : "Normative sulla privacy",
            color : "#fff",
            link : "http://demo.paybay.it/web/termini",
            underline : 1
        }]
    }
});

Regards,
M

@dezinezync
Copy link
Contributor

Can you please try the following, by replacing your attributedText prop with this one?

attributedText : {
        text : string,

        attributes : [{
                text : "Condizioni d'uso.",
                color : "#fff",
                link : "http://demo.paybay.it/web/termini",
                underline : 1
            },{
                text : "Normative sulla privacy",
                color : "#fff",
                link : "http://demo.paybay.it/web/termini",
                underline : 1
            }
        ]
    }

Also, if possible, I'd recommend using the range property instead of the text property. You can use it like so:

            {
                range : [57,23],
                color : "#fff",
                link : "http://demo.paybay.it/web/termini",
                underline : 1
            }

@mantonaci
Copy link
Author

It's work, but for some reason sometimes crash. Below, the full stack trace:

The application has crashed with an uncaught exception 'NSRangeException'.
Reason:
NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds
Stack trace:

0   CoreFoundation                      0x2e84ef53 <redacted> + 130
1   libobjc.A.dylib                     0x38b766af objc_exception_throw + 38
2   CoreFoundation                      0x2e84ee95 <redacted> + 0
3   Foundation                          0x2f17111d <redacted> + 120
4   Foundation                          0x2f17108f <redacted> + 46
5   Passpartu                           0x0040e259 -[TiUILabel(Extend) touchesEnded:withEvent:] + 724
6   UIKit                               0x31147101 <redacted> + 232
7   UIKit                               0x30fb7e4b <redacted> + 5522
8   UIKit                               0x30fefc41 <redacted> + 772
9   UIKit                               0x30fef5e7 <redacted> + 666
10  UIKit                               0x30fc4a25 <redacted> + 196
11  UIKit                               0x30fc3221 <redacted> + 7096
12  CoreFoundation                      0x2e81a18b <redacted> + 14
13  CoreFoundation                      0x2e81965b <redacted> + 206
14  CoreFoundation                      0x2e817e4f <redacted> + 622
15  CoreFoundation                      0x2e782ce7 CFRunLoopRunSpecific + 522
16  CoreFoundation                      0x2e782acb CFRunLoopRunInMode + 106
17  GraphicsServices                    0x3345b283 GSEventRunModal + 138
18  UIKit                               0x31024a41 UIApplicationMain + 1136
19  Passpartu                           0x0003a19b main + 114
20  Passpartu                           0x000396f0 start + 40

2013-10-25 10:32:54.295 Passpartu[1968:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds'

@dezinezync
Copy link
Contributor

Ah! Happens when you tap a link? This is a known bug and I'm trying to find a fix for this. 

Cheers,
Nikh.

On Fri, Oct 25, 2013 at 2:09 PM, Michele Antonaci
notifications@github.com wrote:

It's work, but for some reason sometimes crash. Below, the full stack trace:

The application has crashed with an uncaught exception 'NSRangeException'.
Reason:
NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds
Stack trace:
0   CoreFoundation                      0x2e84ef53 <redacted> + 130
1   libobjc.A.dylib                     0x38b766af objc_exception_throw + 38
2   CoreFoundation                      0x2e84ee95 <redacted> + 0
3   Foundation                          0x2f17111d <redacted> + 120
4   Foundation                          0x2f17108f <redacted> + 46
5   Passpartu                           0x0040e259 -[TiUILabel(Extend) touchesEnded:withEvent:] + 724
6   UIKit                               0x31147101 <redacted> + 232
7   UIKit                               0x30fb7e4b <redacted> + 5522
8   UIKit                               0x30fefc41 <redacted> + 772
9   UIKit                               0x30fef5e7 <redacted> + 666
10  UIKit                               0x30fc4a25 <redacted> + 196
11  UIKit                               0x30fc3221 <redacted> + 7096
12  CoreFoundation                      0x2e81a18b <redacted> + 14
13  CoreFoundation                      0x2e81965b <redacted> + 206
14  CoreFoundation                      0x2e817e4f <redacted> + 622
15  CoreFoundation                      0x2e782ce7 CFRunLoopRunSpecific + 522
16  CoreFoundation                      0x2e782acb CFRunLoopRunInMode + 106
17  GraphicsServices                    0x3345b283 GSEventRunModal + 138
18  UIKit                               0x31024a41 UIApplicationMain + 1136
19  Passpartu                           0x0003a19b main + 114
20  Passpartu                           0x000396f0 start + 40
2013-10-25 10:32:54.295 Passpartu[1968:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds'

Reply to this email directly or view it on GitHub:
#22 (comment)

@mantonaci
Copy link
Author

Even when i tap a label that haven't a link. Maybe, i found a work around by setting tocuhEnabled false on Label (if isn't a link).

Regards,
Michele

@harrythree
Copy link

Having the same crashes when click events are on a label. Getting the same error as above.

'Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds'

I'm using NappUI module to add drop shadow to a view in another window but still crashes on the label with the click event. But I guess NappUI takes over default titanium UI.

Anyway, hope this helps with figuring out a fix for this bug.

Thanks for an awesome module!

@viezel
Copy link
Owner

viezel commented Jun 30, 2014

@dezinezync should we remove this feature, since its supported by appcelerator now ?

@dezinezync
Copy link
Contributor

Yes please. I have another implementation in place which I shall release once stable in it's own repo. Thanks.

@viezel
Copy link
Owner

viezel commented Jun 30, 2014

try 1.2.3
52f46d0

@harrythree
Copy link

Thanks for the update guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants