How to add iAd in app? - ios

I am reading http://www.raywenderlich.com/1371/iad-tutorial-for-ios-how-to-integrate-iad-into-your-iphone-app and I see that I need to set ios4 base SDK. In Xcode 5 laters base SDK is 7.0. How to set that and other params?

That tutorial is nearly 4 years old. You definitely don't need to set iOS4 as base sdk. You should set base SDK as Latest iOS, and deployment target to the earliest iOS version you intend to support (I'd recommend iOS 7, but that's your call).

Related

Which swift version for iOS 7+

I'm new to iOS development, trying to develop an application.
Once I've seen in these statistics that iOS 7 has a really small market share I decided to support iOS 7 or higher in a way to make an app to all iphone OS available in the market. I also decided to use swift as code language but not sure which swift version should I choose.
Which swift version should I choose for iOS 7 or higher development?
Apple states that
Starting July 2018, all iOS app updates submitted to the App Store must be built with the iOS 11 SDK and must support the Super Retina
display of iPhone X.
(The same requirement for new apps started on April 2018.)
So, your choice are very few, Xcode 9 (with iOS 11 SDK) or Xcode 10 (with iOS 12 SDK).
(I believe we should read the requirement as iOS11 SDK or later.)
And supporting iOS 7 with Xcode 9/10 is very difficult. (I do not know if it is possible or not.) Deployment Target does not accept versions less than 8.0 (*), and iOS 7 Simulators are not provided.
(*) Some versions of Xcode replaces versions less than 7.0 to 8.0, even if I entered the version number manually. And at least, both Xcode versions does not show 7.x in the popup menu of the Deployment Target.
I recommend you to use the latest released version of Xcode (10, which comes with Swift 4.2), and make your minimum supported version to iOS 8.0 or later.
The Swift application will work only on iOS 7+. The Xcode will add the Swift library to every build so, you can use any version of Swift language and all of them will work on all iOS starting from 7th. Apps created with Swift will run on iOS 7+ and Mac OS 10.9 +
so use the latest version always.
You have to use the latest swift version Swift 4.2
As iOS 12 is out now so you have to use iOS 10 and above because we should support recent 3 versions.
Images source
If you target iOS 10 and above then you hit the 95% users

How can I determine whether a property or function in Swift 3 is available for iOS 8

For example, in swift 3 there is a new type and property: Calendar.current, does it support for iOS 8?
The document said the SDK is iOS 10+, but I can run a app using this type property on iOS 8 device. This is very strange.
I want to know is there any place to check the minimum iOS version support for a type, property and function?
Or may be just the document is not updated? I use Xcode 8 GM version.
The Swift Syntax that is available is dependant on the development environment (The version of Xcode), not the iOS platform that Xcode is building for. Therefore swift 3.0 syntax will be valid for any project for any iOS version that is built using Xcode 8+ (assuming you have not enabled the setting to use legacy swift, which uses the older syntax)
As #Eric Aya said, just because it's new for Swift 3 doesn't mean that it won't work on earlier versions of iOS.
This is (somewhat) equivalent to the change of CGRectMake() to CGRect(). You can't use CGRectMake() in Swift 3, but its replacement will work for pre iOS 10 (how else would you do it?).
Swift 3 will work for any project being made in Xcode 8 (unless you specifically choose Swift 2). It does not take into account which version of iOS or which device.
You can read more at the official Swift 3 migration guide.

Can I submit an app supporting iOS 7.0?

Recently I tried to upload my app that supports iOS 7, but iTunes Connect rejected that. So, I tried to change the supported version to iOS 8.0+, it worked.
Is iOS 7 dead? I need to support version 7.0.
Could you help me?
If you want to support iOS 7 users, you can set the minimum deployment target to iOS 7. You need to take great care though that iOS 7 users aren't executing iOS 8 code. You should read up on Configuring a Project for SDK-based development.
FWIW, 82% of users right now are using iOS 8.
The simple answer is "yes". My app supports iOS 7.0 and up at the moment, no problems at all.
You can support ios 7. You have to set your architecture for both 32 bit and 64 bit and you need to take care of your code. You code should work on both os. Apple has changed many classes for ios 8. Set your build architecture and your minimum deployment target.

XCode base SDK version in code

How can I get the version of the base SDK in code? I am currently building for iOS in XCode 6 and using the base SDK 8.1 . I would like to know if there is any define with the value of the SDK to be able to test it and allow building with different base SDKs.
You can find out the version of the current Foundation framework that the code is running against by checking the value of NSFoundationVersionNumber.
If you check out the NSObjCRuntime.h you will find the various version numbers listed in there.
As in regards to building against different versions of the SDK; Apple stops App Store uploads if you don't build against the latest SDK once the cut off date has come into effect - i.e. new apps submitted now must be build against iOS 8 SDK.
What you can however do, is have a lower iOS Deployment Target (this you can find in your project's settings). This will allow for your app to run on older iOS versions, but it will still be built against the latest SDK. Do note though, it is your responsibility to ensure that you do not use any new APIs without first ensuring the current environment supports them e.g. UITextField's selectable property.
If you call that whilst running on iOS 6, your app will crash.
This can be done using __IPHONE_OS_VERSION_MAX_ALLOWED (which is the same version as the base SDK version). That can be compared to __IPHONE_8_0 where 8_0 is the iOS release.
For example, at this point you can use the baseSDK 8.0 or 8.1.

Edit app in order to support both IOS 7 and 8

I had an app that worked with IOS7 now if I change the deployment target to IOS8 I get lot of Deprecated Methods, I want to edit the app in order to work for boht IOS versions, should I keep deployment target to IOS7 and change every deprecated method for IOS8?
Changing deployment target will not work.
Please keep deployment target to the lowest supported iOS version.
Also, Apple provides backward compatibility. So the deprecated methods will work.
For best result use respondsToSelector .
Try to replace deprecated methods but with caution. Keep your old methods as is. And conditionally give support for iOS 8 and above.
Hope i am helpful.
Thanks
If you intend support iOS 7. Set your Deployment Target to 7.0
Within your build settings, make sure that the Base SDK is at least 8.0 (the latest version you want to support) or typically most people will select Latest iOS which will list the latest version that the SDK would support. Currently iOS 8.1.
Deprecated Methods are referring to methods that are outdated BUT they still work because Apple provides backward compatibility. It is just a friendly warning. In the sense of, "Hey you don't need these older methods anymore since you're just supporting iOS 8. There's newer ways to do things in town."
In your case, change deployment target back to 7.0 and if you want to (optional), go ahead and update any remaining deprecated methods that are probably left from iOS 6, iOS 5, etc etc.

Resources