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

setenv("TESSDATA_PREFIX", [_absoluteDataPath stringByAppendingString:@"/"].fileSystemRepresentation, 1); _absoluteDataPath is Nil, doesnt work in iOS 12 #392

Open
bawarkamalqader opened this issue Nov 30, 2018 · 6 comments

Comments

@bawarkamalqader
Copy link

bawarkamalqader commented Nov 30, 2018

I think G8Tesseract.mm file line 168 is sending the method stringByAppendingString to a nil object .

i changed the code like this and it worked :

if (absoluteDataPath != nil) { [self moveTessdataToDirectoryIfNecessary:absoluteDataPath]; } else { absoluteDataPath = @""; }

@bawarkamalqader bawarkamalqader changed the title setenv("TESSDATA_PREFIX", [_absoluteDataPath stringByAppendingString:@"/"].fileSystemRepresentation, 1); setenv("TESSDATA_PREFIX", [_absoluteDataPath stringByAppendingString:@"/"].fileSystemRepresentation, 1); _absoluteDataPath is Nil, doesnt work in iOS 12 Nov 30, 2018
@recepkocur
Copy link

+1

@Gentoli
Copy link

Gentoli commented Jan 14, 2019

This also gives EXC_BAD_ACCESS if tessdata is not found.

@nikolayds
Copy link

nikolayds commented Feb 8, 2019

Simple fix will be:

`

   if (absoluteDataPath != nil) {
        [self moveTessdataToDirectoryIfNecessary:absoluteDataPath];
        //Fixing moved from the below -> use the supplied absolutePath (to change the location of tssdata only when not nil
        _absoluteDataPath = absoluteDataPath.copy;
    }
    //Absolute path is already set by
    // self = [self initWithLanguage:language engineMode:engineMode];
    // to the bundle location
    //_absoluteDataPath = absoluteDataPath.copy;
    _configDictionary = configDictionary;
    _configFileNames = configFileNames;
    
    setenv("TESSDATA_PREFIX", [_absoluteDataPath stringByAppendingString:@"/"].fileSystemRepresentation, 1);

`

@SebastianKumor
Copy link

I am having the same issue and the fixes above did not work on iOS 12.1.4? Any luck making it run ? it worked on iOS 10.3.1 simulator

@altimac
Copy link

altimac commented Mar 21, 2019

Same problem here. To be honest I didn't really look at the documentation nor spent some time on the project, but i'm a bit surprised the demo app does not even run and crashes.

@SebastianKumor
Copy link

this is how I fixed it .

  if (absoluteDataPath != nil) {
            [self moveTessdataToDirectoryIfNecessary:absoluteDataPath];
            _absoluteDataPath = absoluteDataPath.copy;
        } else { absoluteDataPath = @""; }
        _configDictionary = configDictionary;
        _configFileNames = configFileNames;
        
        setenv("TESSDATA_PREFIX", [_absoluteDataPath stringByAppendingString:@"/"].fileSystemRepresentation, 1);

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

6 participants