cordova/phonegap 1.6 crash at second launch - iphone

i use xcode 4.3.2 with phonegap 1.6. my app runs well the first time, but if i close the app in the ios simulator and i launch it for the second time, it crashes. Why?

This is probably only in the simulator. I have had it a couple of times in the simulator but it never happened to me on-device.

I am currently having this issue, except in Android. This is with the release flag. More info can be found here: https://forum.ionicframework.com/t/v2-android-second-app-start-doesnt-work-for-release-version/125583
but here is a copy pasta in case the link goes down:
Synopsis:
My app has a canvas on it on the page html. On second start of initial install, app start doesn’t show canvas. I know because the body tag has a background and the canvas has a different background. The page does not have a module defined for it. This is only when built with --release
Environment:
Ionic: 3.20
Cordova: 7.1.0
Angular: 5.2.9
Android: 6.1.2 (I think build target 25)
jdk: 1.8
Additional Info:
I am sort of doing bleeding edge stuff, but I am now out of the realm of being able to solve this on my own. I am using pixi.js, specifically from an additional interface library called angular2pixi. A2p doesn’t support --aot building.
Before I go on, let me reiterate everything works, even on multiple app restarts for everything other than --release.
The top level architecture is fairly simple:
a2p provides a service that has an instance of pixi. My app uses that service and has a page with a canvas awaiting Pixi’s rendering. When the app initializes, it starts up the pixi service, passing it the canvas reference and voila: html5ified angular.
I have offloaded the actual initialization of the rendering to a user clicked button to make sure it’s not something to do with life cycles but that didn’t work either. Even more interestingly, the button I made didn’t show when the app didn’t load. So likely, this means the ion-content itself isn’t showing!
Most interestingly, if I go into app info and delete storage (not cache) then it works on next app start! I am using localstorage but I attempted removing all mentions of it and no luck. ALSO On second install, or rather what would more technically be an update, the app works on every start after that.
This happens on android and I can’t seem to replicate it in iOS other than the first time I tried. Because it is a release build, it’s difficult to debug. I attempted using Ionic Pro Monitoring to no avail.
So far, my leanings are:
some type of caching causing a bug with the canvas itself
an error that is causing cordova or ionic to terminate
problem with my build process
a2p’s architecture (how could I go about debugging this given I have little knowledge of the underlying mechanics of cordova/ng2 -> native compilation?)
a cordova plugin (perhaps causing one of the above)
So as you can probably tell from my formatting, I’m somewhere between nerd heaven and hell. Such a fascinating problem… but plis halp

Related

Flutter app launch janky and need optimisations

The app I have created seems to open quite slow (and janky) compared to other apps on my phone. It only seems to happen on android
I have tried copying the dependencies to a new project and running it and it doesn't replicate the same behaviour.
I have also changed the original app to only load a red container in the matierial app but its still really choppy on app launch before it loads.
I would post some code but I am not entirely sure whats wrong.
Sorry this is quite vague but I am running out of ideas. I dont really want to have to recreate everything in a new project.
Please note I have done the android v2 migration so it could potentially be linked to this?
Does anyone have any ideas to what could be causing it?
Update:
Forgot to mention this is on profile/release mode.. its not debug mode causing it
Well, it's hard to know why your app is being so "janky" but i'm going to make a few shots in the dark:
Are you running this on an emulator or on a real phone? Emulators will sometimes act weird, and will deliver results that you might not see on an actual android device. If you are running this on an emulator, try launching it on a physical phone. I have had experience with using Android emulators and sometimes trying to open the app at all becomes weird. How old your phone is might also be the cause of this, if it is old.
Do you have too many tabs open? Try exiting out of all of your applications and then open up your flutter app. See if that does anything.
That is all that I have concerning the environment that you are working in. You haven't posted any code, so i'm going to have to ask you about what your app is doing on startup. It would be good if you posted some code or a link to a git repository so that I can see that and be of better help.

My ionic app keeps restarting instead of resuming from last active page

I am creating an android app built with angualar/ionic 5. and currently testing with android studio via enabled debugger on an android device.
The apps works well except for one issue.
The app, when minimized or drawn from the active apps lists restarts instead of resuming to the last active page. I am using angular/ionic 5 and I don't believe this is an issue angular/ionic router since this works fine in pwa/browser versions of the app.
I may be wrong but seems to think this may be due to some missing config for android platforms in config.xml . In my search I came across this
1. <preference name="AndroidLaunchMode" value="singleTask"/> //adding this to config.xml but it did'nt work.
some comments suggested memory leaks may be causing android to shut the app down when it's not in the foreground but tracking the apps memory usage in android studio, it seems to be within acceptable range
My conclusion is that perhaps a problem with ionic/capacitor/cordova core or some bug
This is driving me nuts!
If any one has had this problem, how did you solve it please?. and for those experienced ionic developers . what and where would you be looking at if you this issue. Thank you
I tried a different device on the emulator and it worked also tried a different physical device and it worked. this means that the problem is with my particular device. that leaves a lot of questions since a lot of people use my android brand with similar specifications. will the app exhibit same behaviour when downloaded from the playstore? or this is just an android testing and debugging problem.. i will inform you all of what will come later . thank you
In this case I would suggest you to check your device setting you might have mistakenly added this application in battery optimization mode.
Please check your setting I belive this is the culprits. Not your code
Thanks

UIScrollView doesn't work after App Store update

I have submitted an update of my application to iTunes which I got it approved today. Lately I have downloaded it on my device from iTunes to check and I found one functionality is not working as expected.
Problem:
I have a UIScrollView in my app and has horizontal scrolling. After the update I am not able to scroll it. I restarted the app and then it starts scrolling but scrolling infinite horizontally. I know this sounds stupid.
Immediately I opened my project code and ran it on device to check the issue using development provisioning profile but it is working perfectly over there.
Can any one suggest me what can be the issue? Or how can I debug that what went wrong when I submitted the update to iTunes?
You give us very little to work with, but here are a couple of suggestions:
Make sure you're looking at exactly the same code
Make sure you're testing code built with exactly the same compiler settings. For example, usually when you're running from Xcode you'll compile in debug mode. Don't. Compile it in "release" mode (with all the optimisations switched on)
Don't worry about provisioning profiles; they won't be the problem
If it's affecting all iOS 5 and 6 devices, though, I do wonder how you were testing it? And how fundamental is the scrolling to your app? It did, after all, pass Apple's testing. Maybe it's only happening on your devices because it has some "junk" left over from your previous testing?

Xcode 4.2 not debugging properly

I've imported an iPhone app that I have developed for iOS and am now maintaining it. I've came across a couple of bugs when trying to add to the iPhone's calendar, which I'm happy to try and sort out myself with a bit of debugging.
One problem is that when I go to run the application on the iPhone simulator, it seems to run an older version of the app than the one I am running. I've removed and added another button since then and the old button is still showing when I run it in the simulator. However, when I compile and run this on a device, it loads the correct version and displays the correct version number in the 'about' view.
But... my main problem is that it doesn't seem to debug on the device properly. The app actually works fine except for the calendar problems, but if I put a few breakpoints in so I can see exactly where this is going wrong, it just doesn't seem to step through! The app pauses, and Xcode says the app has paused! I can press step over and continue execution etc and it appears to work, but I can't see it stepping over the code, nor can I hover over variables to see their values.
I've tried reinstalling Xcode multiple times (I did have a problem installing an older version, so I had to wait until the next version was available before Xcode would install).
The stress is: Today is my last day at work, and I'd really like to get this app ready for iOS 5 before I leave.
Has anyone seen these symptoms before? Is there a debug setting that I've missed? Or is it a corrupted installation?
I wish I could help people a bit with more information, but I don't even know where to start looking here. Any code I can post? any settings? (not too familiar with this, I'm a .NET guy usually).
Thanks!
Sorry you're going through a tough moment there Connell; as you said you're not too familiar with all this, I'm laying down a few steps which might help you out. Some are pretty basic, yes, but I've resolved to these steps myself several times when I've encountered similar scenarios;
If you're testing on the simulator, do a 'Reset Content and Settings' from the 'iOS Simulator' main menu. This will remove all old data and settings and give you a clean start.
Do a 'Clean All Targets' from the Build menu. Then go to your physical project folder and delete the Build folder from it altogether before starting to build again.
Restart both XCode and the Simulator (and your Mac too if possible)
Make sure the mode is set to Debug and not Release or Distribution
Even on the device, remove the old app before putting the new one in, and restart it for good measure.
Delete all Provisioning Profiles from the device and install just the one you need.
On the code;
I've noted that the app appears to 'pause' like this a couple of times when I had accidentally created an infinite loop in the code. Double check to see whether there's something which may cause this.
Unless you haven't already done so, throw an NSLog or two in there to see if its really not being executed beyond the breakpoint.
I've had the exact same problem with a project that I started on xcode 3 and then switched to xcode 4. What fixed it for me was changing the compiler in the project settings.
The default compiler up to xcode 3 was gcc, while the default compiler on xcode 4 is LLVM gcc.
Now, I don't know exactly what's the issue that gdb could have with LLVM gcc, but switching the compiler back to gcc in my project settings and doing a clean build fixed my debugging issues.
Might be worth a try.
Have you checked which debugger is being used GDB or LLDB? Select Edit Scheme from the Product menu, and see what the Debugger setting is under the Debug scheme. You could try switching between GDB, LLDB, and None and running in between.

Clean way to programmatically control Safari on iPhone?

The title say's almost all. What I have is short lived server processes that serves a web-based javascript test suite with optionally accompanying back-ends for integration tests (see here for how it's done). I'm looking for a better way to direct the iPhone Emulator's Safari to the URL given.
More, possibly optional background:
Up until iOS SDK 4.0 I've managed to control XCode using AppleScript to start a specially prepared PhoneGap project in this fashion:
AppleScript (referred to as "AS") starts XCode (referred to as "XC")
AS instructs XC to load the previously set up PhoneGap project.
AS instructs XC to launch the PhonePap project.
The PhoneGap project will redirect to the server serving the test suite, and the test suite runs.
In iOS 4.0 SDK, this only works the first round, the next time the test suite runner tries to make XC do the above routine, it fails requesting the previous run to be stopped. And I can't for the life of me find a way to stop the debugging session with AS [1], so I can only run one test suite without manual intervention, witch is pretty much a show stopper for us since we rely a lot on nightly test runs.
Now, what I really want to do is just start the iPhone Emulator, and then start Safari on the emulator with the possibility of sending an arbitrary URL to the emulated Safari.
What I've found so far is iphonesim, but I'm running into this issue and can't get it to properly start pre-compiled apps. A way to circumvent this issue in iphonesim would also be a good way forward.
[1] I'd accept a way to do this as a valid answer too.
I have a very different solution for you.
Write a custom iPhone app that just contains a web view. It will behave pretty much the same as MobileSafari. Then, embed a little web server in the app.
You can then control your app by calling specific urls on that server.
This is a very simple app. Will take you 30 minutes to put together.
This is easily integrated in Xcode or a bigger (Apple) script. You can use commands like curl to open URLs.
This is possible now:
xcrun simctl openurl booted "https://google.com"
https://apple.stackexchange.com/a/198798/144271
Post scriptum: how it was solved in the end.
A while after I asked this question, a user at github added a comment in issue 3 that what you need for iphonesim to work correctly is to give the absolute path to the application to start. So now we have a prebuilt PhoneGap project where a script modifies the contents of the www directory inside build/Debug-iphonesimulator/PhoneGap.app. The absolute path to this directory is then sent to iphonesim, starting up the project now pointing towards the correct server. No AppleScript and no XCode (except for the initial build). The test suite now takes 1/7 of the time it took to run earlier.