I am a software engineering student enrolled in a practicum course where a small team of students works with a third-party client to solve a problem. My team has been assigned a project that involves writing an iOS program. None of us have ever done any iOS programming. We are reading voraciously, but need to come up to speed as quickly as possible since the semester is only 15 weeks long.
My question is regarding testing frameworks. Our team plans to use TDD. Our iOS app needs to support iOS 6 and 7. I thought I read somewhere that XCTest only supports iOS 7 and that we will need to use OCUnit in order to support iOS 6. Is that true? How do we write an app that supports both iOS 6 and 7? Is it as simple as setting the deployment target to iOS 6.0 and not using any APIs that were introduced after iOS 6.0?
You can target iOS 6 and up, but if you use XCTest, you will be able to run your tests only on iOS 7.
I believe you can use still use XCTest, but I would urge you to take a look at Kiwi (https://github.com/allending/Kiwi) in your research. It basically wraps whichever framework you choose (xctest/octest) with macros to give you a spec-style testing option. Also, it has extremely powerful mocking/stubbing support which is essential in unit testing.
Related
I have a macOS app that I wrote years ago; it has been working well on my Mac. Recently I thought it would be nice to have that same app on my iPhone so I added an iOS target to my Xcode project. I have never built for iOS before so I'm on new ground here.Anyway, when I built for iOS, I got an error message: "Cocoa is not available when building for iOS." In Apple's "Cocoa Fundamentals Guide" there is a prominent statement: "Cocoa is a set of object-oriented frameworks that provides a runtime environment for applications running in OS X and iOS."Does that mean I can run an app that uses Cocoa but not build one? I'm at a loss; I have no idea how to get past this one. Can an iOS app be built without Cocoa? How would I even go about doing that? Any suggestions at all will be welcome. I'm running Xcode 12.5 on macOS Big Sur 11.4. My app's UI is written in Objective-C and its muscle is in plain C. Also, my app is only for my own use, not for publication.
Anyway, when I built for iOS, I got an error message: "Cocoa is not available when building for iOS." In Apple's "Cocoa Fundamentals Guide" there is a prominent statement: "Cocoa is a set of object-oriented frameworks that provides a runtime environment for applications running in OS X and iOS."
That's somewhat confusing wording. iOS uses a variation on the Cocoa theme called Cocoa Touch. More specifically, the user interface framework on macOS is called AppKit while the iOS user interface framework is UIKit. If you're comfortable with AppKit, it's not hard to learn enough UIKit to get things done. Other frameworks (Foundation, Core Graphics, Core Data, etc.) are pretty much the same on both platforms.
Does that mean I can run an app that uses Cocoa but not build one?
No. You're going to have to rewrite at least the user interface parts of your app before it'll run on iOS. iOS devices obviously use a somewhat different user interaction model: there's no hardware keyboard, no mouse, a touch screen that can handle multiple simultaneous touches, a much smaller screen, and a variety of sensors that don't exist on the Mac, so a different approach to interacting with the user is different. If you were careful to separate the business logic (model) from the user interface (views) in your Mac app, you'll likely be able to reuse most of that unchanged.
Try to rewrite your code using Cocoa touch or UIKit. I am not good at iOS coding, by the way as I know Cocoa framework is for Mac OS, the framework for touch devices is Cocoa touch.
There is an iOS app developed in iOS 4.3. Now I want to upgrade this app to iOS 9 and later. I can able to run the application even on iOS 10 devices. But there are lot of deprecated warnings regarding the latest SDK.
The main reason I'm posting this question is, while upgrading the app from lower version to latest version, what are the action items to be consider to make the application perfect on latest SDK?
Here are few points I've noted,
Clear all deprecated warning.
Do analyser for memory leak.
Enable ARC if not enabled yet.
Proper unit testing.
Please advice me some more point.
Note: I'm not converting the app to Swift, using Objective-C only.
Update: I know the basic things like changing the deployment targets, update the used libraries / Frameworks to latest one, etc., I want more high level points those features are available in latest SDK comparing with lower one.
Thanks
Here are some more points you have to consider for latest iOS support,
Change deployment target in general setting.
Check for device compatibility for design constraint. There are new devices.
Change the version of your app in general settings.
If there are any functionality for touch event than check if it is possible to implement 3D touch for newer device.
And go for proper testing of functionality and design.
Hope it will help you.
If i create an iOS application in XCode 7.2 with SDK 9.2, will that application work in iOS 6 in iPhone 4?
In general, this is possible - that is where the availability information in the apple documentation comes into play.
You may use iOS 6 as your deployment target and only use the API available on iOS 6.
This will mean your code completion on the current Xcode will suggest unavailable methods and you will be very limited in terms of what the API can do for you.
Also, to cherry pick one of the problems you might run into:
iOS 6 has a whole different approach to authorization for location usage than iOS 9, so you would have to (partly) clutter your code with a lot of version checks to give different implementations for the different versions (and version checks were not available back then). Because, a iOS 9 device will not even ask the user for permissions if you do it the way iOS 6 documentation says you have to do it.
The very fact that you do ask this question might already give away that in general, the answer is
Yes, that can be done with a lot of work that is almost intractable for a single person and in almost all cases not needed.
as the market share of iOS 6 is only a tiny fraction, but in your case, the answer might even be
You will probably fail horribly at some point and should reconsider if this is really necessary. The market share of iOS 6 is really small and you are basically putting in weeks of extra work for basically a hand full of potential users.
Also, as you might have guessed from this (and other answers), if your question is if this works out of the box, the answer is
No.
in general yes or no terms.. yes it is possible.
(Our app spans between 7 and 9)
Supporting ios6 will require a lot of work though since you must take care not to use any features that aren't available on ios6 and iOS sdk6 and iOS sdk9 differ quite a bit :)
I'd consider if it is worth the effort.
Do I have to rebuild my existing apps with the Swift language in order to support iOS8 when it will be released and the most of iPhone owners upgrade to this version? If I must rebuild my apps to new standards or not? At moment my apps are running under iOS6.
My main concern is if I have to abandon the iOS6 version or not.
I watched the announcement, but here's a blog to support me :
Matter of fact, Swift code can co-exist with Objective-C...
Developers don’t need to choose between C for Mac development and Objective-C for iOS development because Swift supports both iOS and OS X and can co-exist with C and Objective-C code.
For the time being, Apple plans to support both Swift, Objective-C, and hybrid apps built with both.
No, you do not need to abandon iOS 6 .. although with 89% of devices running iOS 7, you may considering doing it soon ...
No, you will not need to rebuild your apps with Swift. The compiler compiles Objective C and Swift down to the same code to run on your iPhone and both languages can co-exist. Objective C will likely be phased out gradually over a number of years.
If you still wish to switch your existing apps over to Swift, here's a handy migration guide from Apple.
A quick curiosity.
If I develop an application with ios 5(e.g core audio kAudioUnitSubType_AudioFilePlayer) components and set the deployment target to ios 4 will the ios 5 components work on an ios 4 device?
Since nobody can travel back in time, you cannot use iOS 5 features on iOS 4.
However, you can write an app that runs fine on iOS 4 and uses iOS 5 features if available. For example, you can ask a class whether it implements a method using respondsToSelector:, and if so, you can call it.
With kAudioUnitSubType_AudioFilePlayer, you can simply try to initialize the audio unit with AUGraphNewNode but on iOS 4 you will get an error (but not a crash).
An application running on iOS 4.x only has access to the APIs available in the 4.x frameworks.
I'd recommend for new apps, as of today... that you develop for iOS 5 using iOS 5 features. After you are done, do some regression testing on iOS 4. Whatever is broken, re-write, or allow the app to do something different at runtime (you can check if an object would respond to a method before calling it ;)). This will allow you to use all the sweet iOS 5 stuff with the least 'settling'. My team created some of the new features in iOS 5 IN iOS 4 (dealing the the navigation controller) so that the code would require very little change.