Native URL Endpoints .plist for Ionic2/Swift stack

I am developing some custom native plugins for rest API’s. I need some help regarding where should I create a URLList.plist with all the url endpoints so that I can call it from the native side.

I saw this approach on another project, setting every url into a plist but I am not able to get the right location on where I will put it. I am using Swift and transpiling it with objc decorators.

On a normal project this would be in the resources and it would be called like this: Bundle.main.path(forResource: “apps”, ofType: “plist”),

Thank you in advance!

The question is also on stackoverflow:

Quick question: Any reason why you are working with a Rest API on the native side instead of Angular/Ionic side?

It was a requirement from the client that every call must be handled from the native side. Probably security issues / CORS ?
I am just migrating the old cordova code to the Ionic2 stack.

Not really. I suggest you asking what brought them to that requirement and see if you can get rid of it. Will make everything much easier - otherwise no testing in the browser or the Ionic View app for example.

It’s not a desktop application so everything will work only on mobile. The old code has this thing and this was created by a security issue regarding the Cross origin requests, that’s why they made native rest api calls. I need a way to put them into one file and the only solution until now is a url.plist.

Ok, I’m just mentioning this becaue normally testing of Ionic apps happens in a browser on desktop as the deploy-to-device cycle is much longer and slower.[quote=“Flassh, post:5, topic:88056”]
The old code has this thing and this was created by a security issue with the Cross origin requests, that’s why they made native rest api calls.
[/quote]

Whatever this was, I don’t think it exists with Cordova and Ionic 2/3 any more.[quote=“Flassh, post:5, topic:88056”]
I need a way to put them into one file and the only solution until now is a url.plist.
[/quote]

Which is of course okay, sorry for not being helpful here. Hope someone else will be able to help you.

You are right, I know there is more work to do, in this cycle, unfortunately we must follow the requirements.:slight_smile: Thank you for your involvement.:+1:

1 Like

solved the issue by using cordova-custom-config Adding then to the config.xml the required dictionary, on ionic build platform it will build and populate the plist.

After this, I used Swift to get the dictionary values.

I mainly solved the problem, though, I wanted to use a separate plist, not the main project plist.