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

Maximum length of NSString in UITextView console #8

Open
grgcombs opened this issue Jul 20, 2013 · 2 comments
Open

Maximum length of NSString in UITextView console #8

grgcombs opened this issue Jul 20, 2013 · 2 comments

Comments

@grgcombs
Copy link

Any thoughts about how to overcome the limitations of appending NSStrings on the consoles UITextView? When we log significant info, we crash as the NSString can't be appended any further.

I'm thinking that an alternative would be to use a UIWebView and use a stream to bring the text into the web view as the log messages come in.

@nicklockwood
Copy link
Owner

I wasn't aware that there was such a limitation - the length of a string is defined as a NSUInteger, so I would have expected it to support up to 4GB of text. Do you know what the actual limit is?

UIWebView would be an option I suppose, although that has performance issues of its own. Another option would be to use a table view, but that would mean implementing some fairly complex logic to handle text wrapping.

@grgcombs
Copy link
Author

I don't know the limitation but it seemed a lot less than 4gb. We were logging some heavy network requests and responses and it killed over after about 10 mins. If guess it was maybe 150-200MB. More than most would normally log so I'm pretty sure this is an edge case.

The table view idea is a good one I hadn't considered. Core data can store tons of crap. If every log statement is a row, a fetched request controller would easily manage the memory and fetch a few at a time so its fast, as well as update automatically with new logs as they come in.

Auto Layout could help take care of text wrapping -- set the max preferred width on the label, number of lines to 0, then use intrinsicContentSize to give the height of the text. Sweet!!!

G

Sent from my iPhone.

On Jul 20, 2013, at 2:00 PM, Nick Lockwood notifications@github.com wrote:

I wasn't aware that there was such a limitation - the length of a string is defined as a NSUInteger, so I would have expected it to support up to 4GB of text. Do you know what the actual limit is?

UIWebView would be an option I suppose, although that has performance issues of its own. Another option would be to use a table view, but that would mean implementing some fairly complex logic to handle text wrapping.


Reply to this email directly or view it on GitHub.

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

2 participants