Tesseract crash - ios

I am using tesseract on my iOS device and it was working properly until recently it started to crash on me. I have been testing with the same image over and over again and prior to now I had it working about 75 times consecutively. The only thing I can think of is that I deleted the app from my iOS device and then ran it again through Xcode.
I am far from an expert on tesseract and I could really use some advice on what to do next, it would truly be a disappointment for all the hours I put in to go to waste because I cannot read the image anymore. Thank you
This is the crash error it appears to happen when the tesseract file in this method
- (BOOL)recognize {
int returnCode = _tesseract->Recognize(NULL); // here is where the arrow points on the crash
return (returnCode == 0) ? YES : NO;
}
This is the snapshot of the crash

Related

iOS crash below iOS9.3 with SIGSEGV, different Crash Log

Many crashes happened below the iOS9.3 (which means devices with iOS10 are OK)..
The crash logs seem to show that it's not a problem about API that can only be used below iOS 9.3 .
But I have no idea about the crash logs. ( I'm sorry ...for I just start to study iOS development for only 2 month )
Could you please help me analyze the crash logs ?
Really Thanks !
crash log 1
crash log 2
AXE_BAD_ACCESS - this is problem with memory. One of function tried to use variable which already released. I think you need to check use your TableView and cells for this table.
Also to find problem with memory you can try to use zombies
Used to have the similar strange crashes in my app. And only in production, when testing from TestFlight. Building on device with ios 9 caused no problems.
Maybe it sounds strange, but try to convert all images you use in app to images with included sRGB color profile. For me it helped.

EarlGrey launches APP with black screen

After successfully adding EarlGrey to existing project (using CocoaPods) project is successfully built (both "for running" and "for testing"). The problem is that if I run the app from XCode it runs as expected. If I run it as a test only splash screen appears and then whole screen turns black. Have anyone encountered such issue? What might be a problem here?
There is somewhat similar question Black screen with EarlGrey but author did not share his solution.
Additional info:
XCode 8
CocoaPods 1.2.1
EarlGrey 1.9.3
I followed #khandpur advice and tried debugging my app first. So I found out, that in main.m file we're checking if current run is a test run, by
BOOL areWeRunningTests = NSClassFromString(#"XCTestCase") != nil;
Based on that we are running app differently.
To everyone in similar situation: I've added a check
BOOL areWeRunningUITests = NSClassFromString(#"EarlGreyImpl") != nil;
and if that's true app is starting normally.
Final comments - you have to know your app a little to be able to use EarlGrey easily... :)

Keychain error -34018, unable to delete current dictionary

I have an app that is written in Swift 2.3. The app uses the KeychainItemWrapper that makes accessing the Keychain simpler.
When I run the app in the iOS 9.3 simulator with Xcode, the app runs as expected and there are no issues reading/writing to the keychain.
The same exact app, without any changes in my code, crashes with the call to:
- (void)resetKeychainItem
With the line:
SecItemDelete((__bridge CFDictionaryRef)tempDictionary);
Thus making this NSAssert give me my error:
NSAssert( junk == noErr || junk == errSecItemNotFound, #"Problem deleting current dictionary." );
Researching this error by the code 34018 pointed me to other posts with users experiencing a bug with the keychain that was actually brought to the attention of the devs at Apple. It was made a high priority bug, and one post suggested iOS 9.3 had a fix for this (my app works on iOS 9.3!).
However, it is my understanding that Xcode 8 handles such things as code signing differently than previous versions. So I wonder if with iOS 10 if this is a possible new bug.
If anyone has any ideas or experience with this error on iOS 10/Xcode 8... please share your suggestions.

EXC_BAD_ACCESS(Code=EXC_ARM_DA_ALIGN) Only when running app on device from Xcode

I'm getting a really weird EXC_BAD_ACCESS(Code=EXC_ARM_DA_ALIGN) crash on my app which is written in swift but only when i run it on a 32 bit device and only if its running from Xcode (the device is still hooked to Xcode), If i start the app without Xcode it runs fine. I can't give any code since no matter what i do i get no stack trace or anything like that .Only the mention error on the AppDelegate, even though the crash is in different screens further in the app (crashes on second screen).
Any idea as to why the crash would happen only when Xcode is running the app
You are using some variable or object which is yet to be initialised. Please review your code and you will get the error. You can add exceptional break point to get the actual position of the error.
It's a memory alignment issue. Search on EXC_ARM_DA_ALIGN.
https://brewx.qualcomm.com/bws/content/gi/common/appseng/en/knowledgebase/docs/kb95.html
use memcpy
char*Code; int pc;
double f;
memcpy(Code+pc, &f, sizeof(f)); // instead of *(double*)(Code+pc)=f; that generates EXC_ARM_DA_ALIGN

EXC_BAD_ACCESS in device, not in simulator

I have implemented adwhirl in my project. I have implemented it previously in my projects, so I just incorporated it into my current project from my previous.
- (UIViewController *)viewControllerForPresentingModalView {
{
return self;
}
I had used this in my previous projects..since my window.rootvviewcontroller was self only. But in my current project there are many screens on which I am showing ads, so I have used:
- (UIViewController *)viewControllerForPresentingModalView {
{
return return [[(AppDelegate *)[[UIApplication sharedApplication] delegate] window] rootViewController] ;;
}
The main problem is the program was crashing, and still is. At first everything was okay: iads test ads loaded up, but it crashed rarely. I soon understand it was because of Admob. It crashed rarely because admob ads were not loaded most of the time.
Now searching for these crashes, I came across a point that since I have made the project in Xcode 4.2 rather than my previous projects Xcode 4.0 there were strong attributes in my window and view controller. I removed it.
Now the problem is in simulator it doesn't crash but it crashes in device.
The error is after I have added adview as a subview and it has - (UIViewController *)viewControllerForPresentingModalView went through this function but before adWhirlDidReceiveAd method.
The actual crash is [GADRequestPrivate spamSignals] EXC_BAD_ACCESS.
Below answer has already earned bounty for me :) ..... you can try for your problem...
Link : Getting to the bottom of crash
I found one of the best way to Debug the code for Crash. Follow the link for Debugging technique:
http://www.cocoadev.com/index.pl?DebuggingAutorelease
You need to analyze your Console very carefully to see actually why the Crash occurs. This helped me in almost all of the Code that are without ARC enabled.
I recommend you analyze your project and look for memory leaks and zombies. It seems like you are sending a message to a released object which causes the invalid memory access. The zombies detection cannot be run on the device, but you can run it on the simulator. Take a look at Xcode Instruments - Enable NSZombie Detection? Where is it?
Hope it helps.
Even if this happens in proprietary Adwhirl code, you can learn a lot by turning on all the debugging flags as specified, for example, in How to break on __NSAutoreleaseNoPool. This answer discusses lots of debugging flags, not just autorelease pool ones.

Resources