Best practice in SWIFT to detect whether WKWebview is available? - swift

I'm developing an iOS app that wrap a single-page-web-app in SWIFT. I'm targeting iOS 7 and above. I'd like the app to use WKWebView and fall back to UIWebView for iOS 7. Detecting the OS version is one way, but I don't think it's the best practice. I know there must be a simple way to detect the feature, but I'm new to SWIFT. Thanks in advance for your help.

Related

Can Swifter be used for a tvOS app?

I am trying to access twitter data for a social media app for tvOS as a school project. I have come across Swifter (https://github.com/mattdonnelly/Swifter) and noted that it does only say it supports iOS and Mac. I was wondering if there is any workaround to use this in tvOS since they are all written in the same language?
(as you can tell I'm pretty new to this)
Looking at the issues in the repo it appears somebody is already working on adding tvOS support so hopefully that might be ready in time for you.
In fact, somebody may have already done it: https://github.com/kindoblue/Swifter

How to publish iOS Apps on Mac desktop [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Is there a way to convert an iOS app to a Mac OS X app?
I want to publish my iPad & iPhone apps on Mac desktop too, is it possible to do, if yes so for that what changes I need to do in my code.
Well you can't do it directly, since iOS use CocoaTouch and classe like UIButton, UITableView, UIViewController, ... aren't available on OS X.
You can use most of you code which is do not use any of the CocoaTouch components since Cocoa is also Objective-C.
You may think it in MVC direction. Your modal could be reuse, while the view need to redefine. And of cause the controller could be a bit different since it is a bridge between View and Modal.
rckoenes explain in framework aspect. If you think in MVC aspect, I think it could be easier to understand.
I hope it help. Thanks
iOS development is similar to Mac development but not the same: they use different GUI libraries (AppKit vs UIKit).
You could look into an open source solution such as Chameleon, which is UIKit reimplemented for Mac. It has some limitations but is also surprisingly impressive!
Otherwise, as others have said, you'll be rewriting your GUI.

Can I update an iOS 5.0 only app to handle legacy support?

I know the best way to go about this would be to offer legacy support in the first place, but my situation won't allow this. My question is will Apple allow me to go back like that, or is it forward progress only?
Thanks!
You want to add iOS 4 support to what is now an iOS 5 only app?
Yeah, there is no problem with that. Go for it.

Flash iOS applications

I am currently building an iOS application with flash CS5 and I would need some help with a couple of the features:
Is it possible to add in-app purchases? If yes, how does that work?
Is it possible to add iAd advertising to the app? If so, how? If not, is there any good alternative that works with flash?
How can I save data from within the app so it will be there eaten if the user restarts the app and even the device (like for a headboard and such)?
Any help is highly appreciated!!! :D
If it were a few months ago. Then answer would be an unequivocal no. However, presently, the answer is "perhaps" (or if you are an optimist, "probably"). With the release of Air 3.0, it now supports Native Extensions. These extensions are native code that have a wrapper API around them so that they can be compiled in with and called from an Air application.
In fact, I decided to look around real quick while researching for this answer and found a repo where it looks like somebody has implemented in-app purchases via a ANE. But I haven't tested this extension personally, but it may be a good starting point to see how it is implemented.
The reason you wont find too much information about ANE's yet is because they were only recently supported in the Air 3.0 update that happened last month. They are currently unsupported in Flash CS5 (or 5.5) or Flash Builder 4.5. They are supported in Flash Builder 4.6, which is currently in a closed beta. But you might be able to sneak in still, and it should be released soon.
The biggest "drawback" is that these extensions need to be developed in the native format for the device you are targeting. So that means, if you want to make an iOS extension, then you are writing it in Objective-C and xcode on a mac.
Pretty much the same answer as before. It should be possible with a ANE. But I haven't found any examples of anybody doing it yet.
It is very simple to save data/state to the device. You'll want to look into the SharedObject.getLocal() method if you want to the LSO. Or you can just use low-level File writing. Check out File.applicationStorageDirectory. For sensitive information that should be encrypted into into the EncryptedLocalStore class, which I believe is supported on iOS but not on Android.
All of these should provide a good way for you to persist data between application sessions.
With AIR 3 you can now use native extensions to call into the native platform code to achieve the functionality not provided by AIR Actionscript APIs. To answer your questions.
in app purchase. I have a sample at http://code.google.com/p/in-app-purchase-air-ios
iAd. I have a sample at http://code.google.com/p/iad-air-ios/
As others have already answered use local shared objects.

Customising a TableView - iPhone

I am trying to customise a TableView in my iPhone application. I have found many tutorials that do this but they are all for version 3.0+. I want to make my application as generic as possible so I can get it to work on as many iPhones/iTouches as possible.
Is it possible to create a customised TableView for 2.2.1 to 3? I've found nothing and am beginning to think that it's not possible.
You can customize the table in 2.2.1 AFAIK. In fact the tutorial you linked to above was written months before iPhone 3.0 was released!
But I have to agree with the comments above, supporting anything below 3.0 is probably not worth it. In particular, pre-3.0 you would initialize a UITableViewCell using initWithFrame, a method now deprecated. So if you decide to support 2.2.1 you risk your app not working on future releases of iPhone OS. With 4.0 around the corner this would not be a wise move.