iPhone: Sharing data between native and webapp - ios

I would need to share data (not necessarily a large amount) between a native iPhone app, and a safari/webkit javascript app... Do you know how this could be done ?
I considered sqlite.. But it seems an application can only read/write inside its own bundle (so, not in the webkit databases directory), and the other way, i guess javascript can't access an application directory.. right?
Could there be a shared folder that both could access? Not necessarily with sqlite..
I thought also of pasteboards, but they don't seem to be interoperable; and moreover, another app could overwrite the pasteboard in between...
Do you have some other ideas?

You really can't. You can get some data from the JS app to a native app by having the JS app use a custom URL that the native app has registered to invoke, but aside from that you won't have much luck.
You can, of course, share the data through a server somewhere else.

The simple answer that you probably already thought of but decided against would be to have the iPhone and web application both download information from an external source (say, the web site that you're hosting the webapp on). Of course this means that your data is external to the phone which is probably why you're asking this question.
Another approach might be to register your native application as a protocol handler. Not sure how that would work as I've not played with that functionality.

Related

Is iOS capable of accessing and manipulating files on a Windows network file share?

I'm planning an app for work and venturing into potential features which I've not used before.
Essentially I need to be able to access files on a network share, read, write and delete files as well as amend the file names. As a pretty closed platform I'm not sure whether iOS is capable of such a thing and if it is, what features should I look for to begin researching?
My Google-Fu hasn't come up with anything thus far so hopefully looking for someone to point me in the right direction.
Thanks.
I know this isn't very secure, but I'd personally create an ASP.NET app on your target Windows Server, or a different Server on the domain. Create web services exposed, and make an iOS app with UIWebView. You can do RPC calls from the web service that do WMI/ADSI/File System manipulation. You can prompt for domain credentials, and do remote calls essentially is the gist.
You could expose the web app so that your app can access it from local network, or URL. If you were to access it from outside I'd suggest using some secure credentials in Windows/IIS.
Some years ago I created a "mobile-friendly" web app that allowed me to manage servers, perform RPC, and do basic Active Directory queries. Also allowed file listing and deletion/moving/copying with some creative scripting. It was essentially a ASP.NET/C# web app that loaded in a iPhone app. UIWebView in iOS was a able to load it, used AJAX and some other client side scripting that looked decent. You'd essentially have to make sure that your web app renders properly in Safari/UIWebView (which is bastardized safari).
Here's a link to a demo of what I created:
https://www.youtube.com/watch?v=czXmubijHwQ&t=12s
I ran it in a browser, but it'd run from my PSP, Android test devices, iPod Touch, Blackberry, etc.

Programming with swift backend and Angular 2 front. Is it possible?

I didn't find anything on Google saying about it.. so, is it possible?
i.e discard the XCode's Storyboard and use Angular 2 to make apps.
PS: Swift isn't discartable for me due frameworks and done backend code. I am using FFT algorythm from Swift's AudioKit Framework.
Angular2 can be used with any compliant web server written in any language. As long as it speaks HTTP correctly it doesn't matter what it's written in.
Angular2 is a front end JavaScript based technology. As long as you have a web viewer that can render HTML and has a standards compliant JavaScript runtime you can make it talk to your back end.
You can wrap it in an app store compatible package but it will still be a JavaScript app and will connect to your backend in the exact same way that it would if you targeted the browser. The difference is it'll be able to leverage certain device specific capabilities. You will communicate with your backend by sending JSON (any format can be used) back and forth.
The key point is that all communication will be in the form of serialized messages only.
Even if your backend were running on the same device, there's no shared memory space.
Of course since a mobile app can persist it's own state locally it might not need a backend at all. This last point is very domain specific.
It could be posibble if you use Vapor as your backend engine. Take a look at Vapor's website for more info.

Build entire iOS app as a website?

This might be a silly question, but wondering if I was able to build an iOS app completely in a UIWebview. Essentially not have one thing be native to iOS.
You can actually. There are several ways to use HTML5, CSS3, and Javascript to make mobile apps like iOS. You can use frameworks/programs like Cordova/PhoneGap. These frameworks/programs can let you use web languages and then compile it into an executable for the device. Something that can be submitted to the AppStore. Whether or not Apple accepts it thats another story. ;)
The other thing you can do is you want it to completely run off the web is you can essentially build a web app on a server like any other web app. However, you can put in CSS3 media queries and Javascript that can detect the size of the screen. Users can use their built in web browsers to access your site. If the screen isn't the right size, then you can redirect the user like if they try to access it with a laptop. With this method you can use server side scripting languages like PHP to do your computation processing. However, connection is required to the server and if a whole lot of people log in to your server, then the server can get bog down.
If you are interested in using web base languages for mobile applications, I highly suggest looking into PhoneGap/Cordova.

Is it possible to substitute a server backend using Dropbox?

I am developing an iOS application (to be deployed on the App Store) that requires content updates on a weekly basis.
I understand that the best way to achieve this would be to use a server, where the app would query for new data and download responses in JSON. However I am not knowledgeable when it comes to HTML, PHP or MySQL and therefore am endeavoring to find an alternative.
Here's an idea: using Dropbox to substitute for a server backend. My app connects to one central Dropbox account, checks for new files, and downloads them if present.
Is this idea feasible? If not, are there any alternatives?
Dropbox cannot be a dependable substitute for your server/backend for following reasons:
Dropbox uses OAuth for authentication, which needs user interaction. You do not want your app users to go through Dropbox authentication with your 'common' credentials.
Users who have a Dropbox account or the app installed, will most likely use their own credentials to login which completely breaks your flow.
Drobox, although a good way of sharing and syncing files is not meant for more meaningful data like web services etc or user/database interaction etc. Just syncing JSON file may suffice your app's needs for now but from a long term perspective you want a proper back end.
As suggested in the comment by #tkanzakic you can use one of the substitution services if you don't want to get too technical on the backend.
I am pretty late to the party, but this is possible and not necessarily a stupid idea (though this depends on what you need). You might want to have a look at remote storage for example, which allows you to use Dropbox among other providers as backend.
For sure, you can use the Dropbox Sync API to achieve this (https://www.dropbox.com/developers/sync).

Best Way to Store Device Configuration for iOS Application

I am developing an iOS application that is more of a permanent install type application, and it will be different per client. So, I'm looking for the best way to install some type of a configuration on the device that the app can detect and in essence 'lock' it into a specific setting for a client. I want this to persist even if an application is deleted.
Something like a mobileconfig file would be neat, but I don't think those can contain undefined variables or be read by the applications.
I'm curious what the best and cleanest approach would be for this.
As the other answer and comments have said this cannot REALLY be done without the device being jail broken. However... There is a possible alternative.
You can use OpenUDID or SecureUDID to create a unique identifier, then create the configuration in your server database. The application will connect to your server to obtain the global configuration should the configuration file not exist. This way, if the user uses your application, then deletes the application and then reinstalls it, you will still have their configuration which the application can redownload and store locally on the device.

Resources