ios Archive

TUTORIAL: Using UICollectionView with UICollectionViewFlowLayout

Showing data in a gridview is a beautiful and space-saving solution for graphical data (e.g movies, books, pictures etc). It has been popular long before Apple introduced UICollectionView in iOS 6 – a powerful and highly customisable way

A Quick tip: Adding and removing NSNotificationCenter observers in UIView subclass

It is sometimes needed for a UIView subclass to register as an NSNotificationCenter observer. However, there seems to be no good place for adding/removing NSNotificationCenter observers… The best place, I have found so far, is in willMoveToWindow: and didMoveToWindow

How to detect a jailbroken device programmatically?

Why is it necessary to detect a jailbroken device? Sometimes it’s necessary to restrict iOS app to run only on non-jailbroken devices. For example, it might be useful for media applications to make content piracy more difficult

How to use NSLog and print only for debugging?

Why NSLog and print are dangerous? Using NSLog and print are very popular logging mechanisms in iOS applications. However, in most cases logging to standard output is useful only for debugging applications and is useless in the released application.

Private iOS API: Toggle location services programmatically

Use this snippet to toggle location services on your device programmatically. Snippet: Required entitlements: com.apple.locationd.authorizeapplications is required Download the example entitlement file from here: location.entitlements Compatibility: Confirmed working on jailbroken iOS 9.0  

Private iOS API: Toggle mobile data programmatically

Use this snippet to toggle mobile (cellular) data on your device programmatically. Snippet: Required entitlements: This requires com.apple.CommCenter.fine-grained entitlement on iOS 8.3+. Works without entitlement on iOS 8.1.2. Download the example entitlement file from here: cellular.entitlements Compatibility: Confirmed working on

Jailbreak development: Toggle airplane mode programmatically

There’re plenty of iOS development materials online, but not that much information regarding iOS jailbreak development. Therefore, I’m gonna share a bunch of code snippets to solve simple tasks in jailbreak development that I found myself useful

Private iOS API: Kill another application programmatically

Use this snippet to kill any application programmatically. Snippet: Required entitlements: This requires com.apple.multitasking.termination. Download the example entitlement file from here: killapp.entitlements Compatibility: Confirmed working on jailbroken iOS 8.1.2, iOS 8.4, iOS 9.0 Additional headers: Download BackBoardServices.h

Jailbreak development: Launch another application

There’re plenty of iOS development materials online, but not that much information regarding iOS jailbreak development. Therefore, I’m gonna share a bunch of code snippets to solve simple tasks in jailbreak development that I found myself useful

Swift Application size – an unexpected pitfall of Swift

Recently I have successfully finished my first commercial Swift project. The last step was easy – create the production build. As I’m usually developing both for Android and iOS, it’s interesting to compare binary sizes for Android