Todd
Todd

Reputation: 153

Tesseract initialization error

Using this github page, https://github.com/robmathews/OCR-iOS-Example, I downloaded and installed the repo and followed the instructions. Trying to launch the .xcodeproj file on my phone gives an exception in Tesseract.mm:

- (id)initWithDataPath:(NSString *)dataPath language:(NSString *)language {
    self = [super init];
    if (self) {
        _dataPath = dataPath;
        _language = language;
        _variables = [[NSMutableDictionary alloc] init];

        [self copyDataToDocumentsDirectory];
        _tesseract = new tesseract::TessBaseAPI();

        BOOL success = [self initEngine];
        if (!success) {
            return NO;
        }
    }
    return self;
}

On the return NO line, xcode says Cannot initialize return object of type 'Tesseract *' with an rvalue of type 'BOOL' (aka 'bool').

What am I doing wrong?

Upvotes: 0

Views: 537

Answers (1)

iCaramba
iCaramba

Reputation: 2640

NO is a bool value. The return type is (as you defined) id (should be instancetype )

You've to return nil there.

Upvotes: 2

Related Questions