I use DTHTMLAttributedStringBuilder of DTCoreText to display HTML code in UITableViewCell. But it has an error.
This is my code:
NSDictionary *builderOptions = #{DTDefaultFontFamily: #"Helvetica"};
DTHTMLAttributedStringBuilder *stringBuilder = [[DTHTMLAttributedStringBuilder alloc] initWithHTML:[word[#"name"] dataUsingEncoding:NSUTF8StringEncoding] options:builderOptions documentAttributes:nil];
NSAttributedString *stringAttri = [stringBuilder generatedAttributedString];
cell.textLabel.attributedText = stringAttri;
This is error:
[__NSCFType lineBreakMode]: unrecognized selector sent to instance 0x7f7f7bd1ba60
2015-06-06 11:16:38.898 PhrasalVerb[786:18798] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType lineBreakMode]: unrecognized selector sent to instance 0x7f7f7bd1ba60'
I had the same issue. Turns out I was trying to set the text on a UILabel and not a DTAttributedLabel.
Related
Hi Guys i was wondering how to set the image of an UIimageView that is in a cell. I'm rather new to coding so please fully explain if u can. I currently have this:
cell.image.image = [tempObject objectForKey:#"CafeImage"];
But the app crashes with this everytime:
-[PFFile imageAsset]: unrecognized selector sent to instance 0x7a96cd80 2015-02-22 15:06:19.616 Cafe[12830:140389] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PFFile imageAsset]: unrecognized selector sent to instance 0x7a96cd80'
It should be cell.imageView.image=[tempObject objectForKey:#"CafeImage"];
first - If you are using a standard cell, you should set
cell.imageView.image = "UIImage object";
second - Data in [tempObject objectForKey:#"CafeImage"] must be kind of UIImage class, or if it's NSString -> use [UIImage imageName:#"for example - objectForKey"];
Getting crash in CMDActivityViewController for iOS8.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ArtViewController activityViewController:dataTypeIdentifiersForActivityType:]: unrecognized selector sent to instance 0x7acb0b80'
Solution to this-
In dataTypesForActivityType method of "CMDActivityViewController.m", return nil , instead of the array dataTypes.
Use this Method as it is
- (NSArray *)dataTypesForActivityType:(NSString *)type {
return nil;
}
I am receiving an "EXEC_BAD_ACCESS" error when I attempt to
instantiate [anImage] in iOS8.
The same code works fine in iOS 7.1 and below.
Any suggestions are greatly appreciated.
//In .h file:
UIImage *img;
//in .m file:
img = [UIImage imageNamed:#"image.png"];
UIImageView *anImage = [[UIImageView alloc] initWithImage:img];
/*
* Here is the stack Trace:
*/
-[__NSCFDictionary _isDecompressing]: unrecognized selector sent to instance 0x16e49740
2014-10-07 08:56:35.319 [AppName] [222:7088] *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[__NSCFDictionary _isDecompressing]: unrecognized
selector sent to instance 0x16e49740'
*** First throw call stack:
(0x27e50e3f 0x35528c8b 0x27e56189 0x27e540a7 0x27d86208 0x2b2faf55 0x1011bb 0x103d27
0xfe759 0x1029d7 0x10060d 0x2b31fd4b 0x2b31fcf1 0x2b30a96b 0x2b32827f 0x2b2e45cd
0x27e175cd 0x27e14c8b 0x27e15093 0x27d63621 0x27d63433 0x2f0d20a9 0x2b34e359 0xe9b05
0x35aa8aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException
i have created one custom cell and put button on it
and button event is like this
[cell.BtnRequest addTarget:self action:#selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside];
and didtapbutton code is this
- (void)didTapButton:(id)sender {
WorkerDetailsVC *wvc=[self.storyboard instantiateViewControllerWithIdentifier:#"workerdetailsvc"];
NSIndexPath *indepath = [self.tblorderdata indexPathForCell:sender];
wvc.arrworkarrequest=[arrData objectAtIndex:indepath.row];
NSLog(#" arr send :%#", wvc.arrworkarrequest);
wvc.struserid = struserid;
[self.navigationController pushViewController:wvc animated:YES];
}
and on the next page i got the array arrworkarrequest and after the load all next page it will show error like this
2014-10-01 15:08:42.607 demo[2151:60b] -[__NSCFNumber length]: unrecognized selector sent to instance 0x911a860
2014-10-01 15:08:42.613 dmeo[2151:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0x911a860'
Your problem is that sender is of type UIButton not UITableViewCell so it's getting stuck in the [self.tblorderdata indexPathForCell:sender] because that method call expects a type of UITableViewCell.
You need to find the Cell that the button is in. You may be able to do this using a while loop (although it's a bit horrible). Something like:
id obj = sender;
while (![obj isKindOfClass:[UITableViewCell class]]) {
obj = [sender superview];
}
[self.tblorderdata indexPathForCell:obj];
This feels like it's abusing the view hierarchy though.
This happens if you compare the length of a string directly
for example
NSString *myString = #"2";
using this statement will generate the error
if(myString.length==2)
This is my code to display an attributed string in a UITextView
NSMutableAttributedString *recipeString =[[NSMutableAttributedString alloc]init];
[recipeString appendAttributedString:string1];
[recipeString appendAttributedString:string2];
[array addObject:recipeString];
This code is inside a for loop. string1 and string2 are NSMutableAttributedStrings.
After that:
self.textView.text = [array objectAtIndex:self.appDelegate.selectedCell];
The text view is an IBOutlet.
It crashes with this exception:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteAttributedString _isCString]: unrecognized selector sent to instance 0x8e866f0'
Any ideas on how to fix this crash?
I had to use the attributedText property of UITextView:
self.textView.attributedText = [array objectAtIndex:self.appDelegate.selectedCell];
For future users:
-[NSConcreteAttributedString mutableString]: unrecognized selector sent to instance
this may also be caused by if in the above instance string1 or string2 is nil