@findMarcel thanks for the stackoverflow post, unfortunately the solutions on them haven’t worked for us so far.
We’re testing on a physical device, iPad Air on the latest iOS version 14.7.
Were you able to find a solution elsewhere?
thanks
@findMarcel thanks for the stackoverflow post, unfortunately the solutions on them haven’t worked for us so far.
We’re testing on a physical device, iPad Air on the latest iOS version 14.7.
Were you able to find a solution elsewhere?
thanks
Good advice on checking the logs.
For me it was the OPTIONS request in that Angular does with HTTP GET requests that was sending it twice.
Handling the preflight to just process the authentication and exiting after prevented double triggering of the PHP service.
Thankyou very much it solved my problem
Is avaliable in all countries? and it have more fees or just the google ones?
Then, as the documentation says:
If you require a complex form UI which doesn’t fit within the guidelines of an alert then we recommend building the form within a modal instead.
I think you are outside of the intended usage zone for alerts.
Is there any provision for integrating in-app purchases where Google and Apple get their cut?
Hey there! Im currently developing an App and i wanted to ask if there is a good way to solve that.
I want to have the Header and the Footer only in specific pages.
Currently my app.component.ts is looking like this. How can i set the headerVisible and footerVisible for every seperate router-outlet?
<ion-app>
<app-header *ngIf="headerVisible"></app-header>
<ion-content>
<ion-router-outlet></ion-router-outlet>
</ion-content>
<app-navigation *ngIf="footerVisible"></app-navigation>
</ion-app>
Thanks for your Answer in Advance
Three random suggestions:
Ionic 5
)Once disabled, the menu will stay that way until you enable it. You can either choose to do that on pages that want it enabled, or when the login page leaves. The latter approach is used by the conference app’s tutorial page.
Incidentally, your API breaks an important REST contract requirement and presumably has a massive security hole.
A GET request must be able to be cached and therefore rerun one, two, or forty times without ill effect. It isn’t supposed to impact server-side state. It’s a bad fit for login. Login actions should be implemented as POST endpoints instead. This will also fix the fact that you are putting plaintext passwords in URLs, which is bad because they get stored and exposed in server logs and by proxies. Secrets need to go in request bodies, not in URLs.
I’m not seeing your login process returning anything (such as a JWT) that is intended for use on further authenticated requests. That tells me that you’re trying to do your “security” client-side, by gating off functionality in the app simply based on whether you have an email address in client-side storage. That doesn’t actually secure anything, because you have no control over the client-side execution context.
The only way to properly secure things in a networked webapp is on the backend, where you do control the environment. Each authenticated request needs to present a valid token, and then you don’t have to care whether somebody has spoofed things.
Finally, don’t mix HTTP clients. Get rid of @ionic-native/HTTP
and just use Angular’s HttpClient
.
I’m using the latest versions of ionic, capacitor and angular and I’m building a mobile app for iOS and android.
I’m trying to save about 15 data elements from a form and then access them on different pages in my app. The data elements are all small text elements.
I’ve already created the form via formbuilder and I can see all of the form data in the console when I submit the form, so that part is working.
Now I need to know how to save it to some storage that will remain on the mobile device even if the user closes the app or turns off the phone. What’s the best storage to use?
How do I access that data from multiple pages?
Thanks SO much in advance!!
I have a modal that displays information and gets the user to select options. The main page content then scrolls to the correct point based on that selection. This much works.
However, when the modal is dismissed, the page scrolls back to the top.
I even tried doing the scrolling in the function called by onDidDismiss, hoping I could get it done after the modal does that weird scrolling back to the top, but it seems to happen after that.
Any idea why the modal is behaving like this? I also noticed similar behavior with an ionpicker. Or is there a way to do the scrolling after the modal does its own scrolling (ie, after onDidDismiss is called)?
Welcome to the Ionic forums.
The first thing I want to emphasize is how important it is to separate the two parts of your question. I’ll address them in reverse order.
The way to access business objects (a term I use instead of “data” in order to emphasize that they’re things like customers, orders, students, trouble tickets, etc, as opposed to implementation stuff like backend server URLs - frequently those two classes of things get mashed together under the umbrella of “data”) from multiple pages is covered in Chapter 4 of the Tour of Heroes:
Create a service, inject it in every page that needs the business objects, expose an Observable
of the appropriate type, subscribe to that Observable
when the page is created, and unsubscribe when the page is destroyed. This post contains some sample code for doing this with user profile settings that should generalize to other situations.
As far as your pages go, that is the end of the story. Period. Full stop.
And that’s why it’s important to separate the two issues, because the way that you store, distribute, and manage your business objects is likely to change over the life of your app, and it’s needlessly painful if those changes necessitate any modification to every page that presents and interacts with them.
As for how to persist business objects, there are several factors to consider. You covered one, which is “do we need these to stay across app restarts?”. That requirement DQs localStorage
. You also said that it needs to “remain on the mobile device”. I suspect it may at least be conceivable that at some point in the future, you will want to send these business objects out onto the Internet, and retrieve them from servers. As long as you make sure to isolate all the details of this into a service, it should be fairly painless to make that change, but for now, we’ll also forget about the option of storing things out in the cloud somewhere.
That leaves, broadly speaking, three options:
SharedPreferences
or iOS’s UserDefaults
I would consider SQLite a bad fit for the sort of data you are describing, because you don’t need the overhead of a relational database here, so we’re down to two, and here are the pros and cons:
IndexedDB works in desktop browsers. This can drastically improve your development productivity (and potential deployment reach, because you can distribute the app not only as a mobile build, but as a PWA). You can reap all the benefits of live reload rapid development, and there is no need to actually build a mobile app bundle and run it on an emulator or device every time you change anything. It’s not “secure” in the sense that anybody with physical access to the unlocked device can read or modify it. I generally don’t consider that a huge concern, and I’m doubting you will in this case, either, given the way you’ve described the data. However, if it is…
The OS-specific storage options are, as you would expect, integrated with the security features of the OS. The data is encrypted at rest and access is controlled directly via lockscreen / passphrase / PIN / biometrics / whatever. This option is, when compared with IndexedDB, a PITA to develop with, because it won’t work in browsers, and must be run on a physical device or an emulator.
So my initial recommendation is IndexedDB, and you deem the specific security threat it poses a sufficient concern, then go with the native option.
Fortunately, whichever choice you make, you won’t have to deal with the underlying API directly. For IndexedDB, use @ionic/storage. For the native options, use @capacitor/storage. Each of those provide future-friendly APIs that will integrate nicely with your service provider that distributes the data to your pages.
One final question that you didn’t ask is “when should I read and write to device storage?”. To avoid race conditions, I have very strong opinions about this. Read only once per app run, either at app startup or lazily the first time the data is needed. Never read the same data from device storage twice in an app run. Following that rule allows you to be much more relaxed about writes: do them whenever you want, and treat them optimistically. Whenever they finish, they finish. You don’t care, because your app isn’t going to read them back until the next time it starts up, at which point either they finished properly or they didn’t, but there isn’t anything you can do about it then.
Pal, I have the same trouble and I struggle a lot and have nothing.
Hi
How to disable capacitor inapp browser cache?
I don’t see anything about it in the document.
Why are either of you torturing yourselves thus?
One of the big reasons you use frameworks in the first place is so that you don’t have to deal with the DOM directly.
If you want to programmatically enable and disable an element in an Angular app, bind [disabled]="foo"
in the template and assign true
or false
to the foo
property of the page controller. Done.
store your data in service page and import them in the pages you want.
Add Ionic Native Storage | Install Cordova Plugin Native Storage to store the value in the forms…
this.router.url returns url of the page. So if you currently in login page use *ngIf="router.url!='/login'"
to hide the menu button
Use ion-header in ion-footer components in every page you want instead of this method
I have deeplinks working fine for both ios and android on my app if I click on them as links.
However when scanning the deeplink url as a QR code ios insists on opening safari and trying to use the url in a google search. “Search Web in Safari”. The QR code works fine on Android.
Any idea why the deeplink url would work when clicked on but not from a QR when scanned with the camera on ios?
I am using iOS 14.6 and the version of the app with the associated domain entitlements has not yet been deployed to the app store.
I just needed to add https:// to the prefix. Friday afternoon error.