Skip to content

unrecognized selector sent to instance #28

Description

@farrukhaskari1

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel setLinksForSubstrings:withLinkHandler:]: unrecognized selector sent to instance

your code with bit modification:
void(^handler)(FRHyperLabel *label, NSString *substring) = ^(FRHyperLabel *label, NSString *substring){
UIAlertController *controller = [UIAlertController alertControllerWithTitle:substring message:nil preferredStyle:UIAlertControllerStyleAlert];
[controller addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
[self presentViewController:controller animated:YES completion:nil];
};

//Step 3: Add link substrings
[label1 setLinksForSubstrings:@[@"to", @"and", @"in", @"of", @"are"] withLinkHandler:handler];

what can be the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions