Mobile Application Penetration Testing
上QQ阅读APP看书,第一时间看更新

iOS application programming languages

A majority of the apps developed for iOS are native apps; these are developed in Objective-C and, since 2015, Swift. Apple has mandated the use of Swift for developing apps. This would be easy for those who have some background in object-oriented programming languages.

Objective-C

Objective-C is a strict superset of and augmentation to C; it is an object-oriented language that adds Smalltalk-style (an object-oriented, dynamically typed, reflective programming language) messaging to the C programming language and was created by Brad Cox and Tom Love in the early 1980s. This means that the Objective-C compiler can also compile C programs. The following diagram provides the sample Objective-C runtime and its components:

In Objective-C, one does not call the object one sends a message to. This language is mainly used on the Mac OS X and iOS operating systems and their APIs. The apps are compiled to native code and linked against the iOS SDK and Cocoa Touch frameworks.

Note

You may need more information about Objective-C, which you can find at https://developer.apple.com/library/mac/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html.

The Objective-C runtime

In Objective-C, all classes are designed in such a way that they are aware of their own states and are also capable of altering their own implementation during runtime. All compiled files (.h and .m files) are linked with a library called libobjc.A.dylib.

Note

The source code of the dylib file can be found at http://www.opensource.apple.com/source/cctools/cctools-525/ld/dylibs.c?txt.

This dylib file provides in-memory runtime functionality to the Objective-C language. A majority of attacks during runtime depend on the libraries that are linked.

Swift

Swift is a new programming language created by Apple Inc. specifically for iOS, OS X, and watchOS and is potentially a replacement for Objective-C in the future. It was first released on June 2, 2014, with a stable release on September 15, 2015. Interestingly, this proprietary software will be transitioning to open source in the near future (https://developer.apple.com/swift/).

Note

Similar to Apple's Swift programming language, Google came up with Go and Dart in 2011. However, Dart was open source. It missed the mark and is less used nowadays. Swift is mandated by Apple to develop apps starting from iOS 8 and Yosemite. You may need more information about Swift development, which you can find at https://developer.apple.com/library/prerelease/mac/documentation/Swift/Conceptual/Swift_Programming_Language/index.html#//apple_ref/doc/uid/TP40014097-CH3-XID_0.