开发者

String truncated in Core-Data on iPhone

开发者 https://www.devze.com 2022-12-19 17:30 出处:网络
I have an Entity (Article) with an Class defined at xcdatamodel. In this class i defined an String NSString *test;

I have an Entity (Article) with an Class defined at xcdatamodel. In this class i defined an String NSString *test;

currentArticle.test = string;

String is more than 50 characters long.

But when i try to fetch the Stored Object with:

Article *article = [fetchedResultsController objectAtIndexPath:indexPath];

then article.test is t开发者_StackOverflow社区runcated (50 Characters long). But it should be longer...

Any ideas?


I've just noticed the same.

As far as I can tell, when logging an NSManaged Object (or a core data error), only the first 50 or so characters of a string attribute are printed. But the actual attribute still has all the characters.


I guess you try to load to the TableView, and it is by default truncated to fit the screen width of the table view.

Put a breakpoint on the line that access the article and see its' value.

Otherwise, you may want to print it out to the console

NSLog(@"my article test string is: %@", article.test);

Edited:

Another note is that your data model may fix the "Max Length" property to 50.

0

精彩评论

暂无评论...
验证码 换一张
取 消