Phonegap 1.2 + xcode 4 = EXC_BAD_ACCESS on keyboard input? - ios

Im not a "high level" programmer. I do not understand all this stuff really which is why I'm using phonegap instead of native programming. I'm doing nothing special. The "page" loads, there is an input box, you click it, keyboard pops up. Letters seem to work OK but as soon as you push a # or back space the whole app crashes with EXC_BAD_ACCESS.
This is in a 4.3 emulator. I do not have a device handy to try.
All the searching I've done are people talking about memory management and what not. I'm not doing any of that, nor would I have idea on how to.
Anyone know why this is happening?
Here is the offending line:
int retVal = UIApplicationMain(argc, argv, nil, #"AppDelegate");
Which is located insde Supporting Files > main.m > main()
^^-- I did not create that file. I'm not sure if phonegap created it or if it was created by xcode.

It turns out the problem WAS the fact that I was testing my code on a 4.3 SIMULATOR on an OSX LION virutal machine running on a win7 host.
I brought my code in to work the next day, hopped on one of the macs, installed xcode and ran the identical code on the simulator AND my coworkers iphone and the problem did not show up, at all!

Related

Address Sanitizer with SpriteKit

I'm trying to diagnose my app with Address Sanitizer.
Although the app runs quite smoothly and I only wanted to get further checks regarding the memory alloc etc. I get the following error when I run the app.
It's my first time using Address Sanitizer but as far as I concerened it needs to point out to one of the developer's line of code.
It seems to me like it crashes at internal libary.
Any ideas or suggestions?
Apparently the problem was that I tried to run the game on an iPad with iOS8.0.
On iOS >= 9.0 it works fine.

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 Using gmaps sdk 1.9.0, Xcode 6.4, running on 8.3 device

I have 2 projects working with google maps sdk, they are currently in the Appstore.
Things to have in mind:
Gmaps sdk version 1.9.0 installed via cocoapods
Xcode version 6.4
Deployment target 7.1
Device: iPhone 4s with 8.3.0
Today I've opened Xcode as usual with the first project, tried to compile and debug on the iPhone and I sometimes get a EXC_BAD_ACCESS (code=1...) crash on the app and sometime get EXC_BAD_ACCESS (code=EXC_ARM_DA_ALING...), no stack trace in here, but always on main.m:
return UIApplicationMain(argc, argv, nil, NSStringFromClass([TGPAppDelegate class]));
Seeing the first thread I've discovered that this is error is related to google maps:
Tried the following:
Updating the pod (didn't work)
Replaced my code with the sample code on gmaps sdk page (didn't work)*
I have read something about auto layout, disabled (didn't work)
The weird part is that I also:
Tried in an iPhone 6 with 8.4 (DID work)
Tried in an iPhone 6 with 8.3 (DID work)
Both project are in an early beta state, so I don't if the are any real user have this problem but I'm worried that some users wont be able to use the apps because of this.
I couldn't find too much information over the internet and I don't even know where to look, is there any reported known error regarding this?, anyone else with the same issue?
Here is the sample code I'm using:
-(void)viewDidLoad {
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:37.80948
longitude:5.965699
zoom:2];
GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
self.view = mapView;
}
EDIT 1:
Doing more tests, found out that the problem appears only when debugging (attaching the debugger when running the app), if you run the app from the iPhone and after that you attach the debugger to the process, everything runs ok, I mean, if the map tries to render when the debugger is attached then you will get the exc_bad_access, it's a debugger error then?, I'm confused
EDIT 2:
This in answered in here , thanks Dave
The answer to this is not mine, this in answered in here , thanks Dave, I' m just quoting him so anyone can see the answer.
I've found the root of the problem and have a workaround:
The problem seems to be triggered by OpenGL ES Frame Capture in XCode;
I'm guessing this problem started when Apple added Metal to the mix as
of XCode 6.4/iOS 8.3, perhaps somehow adversely affecting the entire
frame capture debugging system.
The workaround:
EDIT: I've found the root of the problem and have a workaround:
The problem seems to be triggered by OpenGL ES Frame Capture in XCode;
I'm guessing this problem started when Apple added Metal to the mix as
of XCode 6.4/iOS 8.3, perhaps somehow adversely affecting the entire
frame capture debugging system.
The workaround:
In XCode, go to Product > Scheme > Edit Scheme...
Select the "Run" Tab on the left.
Select the "Options" sub-tab on the top.
Change "GPU Frame Capture" from "Automatically Enabled" or "OpenGL ES" to either "Metal" or "Disabled".
This disables OpenGL ES frame capture, which isn't great, but allows
you to continue debugging your builds.
Not sure if this issue is Apple's or Google's but I'll be posting bug
reports to both. Happy coding!
Same problem here with MKMapView.
Solution is rollback to (run side-by-side) Xcode 6.3.2.
http://adcdownload.apple.com/Developer_Tools/Xcode_6.3.2/Xcode_6.3.2.dmg
Also switch Command Line Tools to 6.3.2 in Preference -> Locations
i had the exact same problem:
iphone 4 -> iOs 7 (working)
xcode simulator (working)
iphone 5s -> iOs 8.3 (NOT working EXC_BAD_ACCESS)
SOLUTION: i updated my iphone to iOs 8.4 and the problem is gone, maps are loading.
hope it helps

App crashes before debugger can connect

I've got an app that crashes even before the debugger can connect.
I placed a break point on the first line of main(). (I added an NSLog statement as very first statement in main() and set the break point there.
The app seems to start. The main screen with some ui elements becomes visible on the screen. Then it disappears.
There is no crash log found on the devices.
Xcode message:
Could not launch "appname"
process launch failed: failed to get the task for process xyz
Debugging is enabled of course.
The same for the profiler Instruments.
Code signing works fine so that the app can be deployed to the devices.
(Same for enterprise distribution. And the app validates for store submission.)
It does work on the simulator though.
The app used to work fine. I was just about to build it for the store. For final tests on iOS 8.1 I upgraded to Xcode 6.1 with SDK 8.1. But the problem did not occur directly after the upgrade. It worked just fine.
Then it crashed when building for release for enterprise distribution.
The AppStore build crashed in the same manner (according to Apple, the app was rejected of course.)
But it ran nicely in debug modes.
Now I was trying whether compiler options for optimization may make all the difference and I was trying to build in release mode with debugging enabled etc and end up with a debug build crashing as well. (No optimization in debug).
So it may well be that the migration to Xcode 6.1 did cause it but the problem may have come effective only after Xcode cleaned and rebuild the project in response to changes to compiler settings for code optimization.
Sorry for the long text. I tried to put everything in that may be of importance.
Reason is most likely some incompatibility of Crackify and iOS 8.1.
Therefore it may be of interest for others, altough my problem along with these symptoms may be very special.
Very early within AppDelegate didFinishLaunchingWithOptions we have had the following statement.
if ([Crackify isCracked] || [self isCertificateUnvalid])
exit(173);
That, as such, is not really well designed. The app is just terminated rather than any error message displayed to the user. Thus, it appears as if the app has crashed. But it has not crashed and therefore no crashlog is provided.
For reasons which I don't yet understand and which may not be related to this error, my debugger did not manage to hook up into the executed app. Once that was overcome (suddenly the debugger worked without any changes made to any of the debugging related settings) the error was found rather quickly.
This is Crackify: https://github.com/itruf/crackify
Within Crackify it was this code sniplet that caused the problem:
static NSString *str2 = #"ResourceRules.plist";
BOOL fileExists3 = [manager fileExistsAtPath:([NSString stringWithFormat:#"%#/%#", bundlePath, str2])];
if (!fileExists3) {
return YES;
}
For reasons that I did not further investigate, the file, that is tested here, apparently does not exist in iOS 8.1 any more.

App crashes without reason with xCode 4

Something weird is going on here.
My app crashes on this line of code:
int end = NSMaxRange(endRange);
but I don't get any error message, and everything is fine: endRange. The app just freezes in the iPhone and that's it.
1.
The weird thing is that the same code was working before, and I've reversed from repository to see what's wrong but it still doesn't work.
2.
Also xCode removes the breakpoint every time the app crashes. I add it again, I run the app, I step over, the app crashes and Xcode removes the breakpoint.
3.
I've cleaned the build, restarted xCode, restarted the iPhone, removed the app from the iPhone. Same issues.
4.
If I don't use breakpoints, the app doesn't crash, but the code right after that line is "skipped", but it was working before. At least the app doesn't freeze without breakpoint.
What the hell ?
I've had similar problems with the debugger in the past too. Try switching from LLDB back to GDB (From the Product / Edit Scheme menu). I've found LLDB to do exactly what you are describing with breakpoints.

Resources