Latest 1.1.1
License MIT
Platforms ios 5.0, requires ARC
Frameworks UIKit


This is a small cocoapod of the excellent SOAppDelegate idea by Nico Hämäläinen. After I used SOAppDelegate in some of my projects I quickly discovered that I didn’t want to use Vanilla AppDelegates anymore. This pod should simplify the setup of new iOS projects.


To run the example project; clone the repo, and run pod install from the Example directory first.

See this blog post for a detailed writeup about this topic.

Step 1

Make your UIAppDelegate implementation a subclass of SOXAppDelegate.

#import "SOXAppDelegate.h"

@interface SOXDAppDelegate : SOXAppDelegate


Step 2

Create your Service classes. You can either use a plain NSObject subclass for that purpose or a SOXService subclass.
NSObject subclasses should at least implement some form of Singleton pattern to prevent multiple instances of your services (there is only one UIApplicationDelegate per App and so should your services).
The SOXService implements the default Singleton pattern, the shared instance is available via sharedInstance.

Step 3

Add the services method to your SOXAppDelegate subclass. We’re assuming MyServiceClass to be the name of your service in this example:

#pragma mark - Services

- (NSArray *)services
    static NSArray * _services;
    static dispatch_once_t _onceTokenServices;
    dispatch_once(&_onceTokenServices, ^{
        _services = @[[MyServiceClass sharedInstance]];
    return _services;

Step 4

Implement all UIAppDelegate methods necessary for your service in the service class. You don’t need to declare the UIApplicationDelegate. Your SOXAppDelegate subclass will call all methods implemented by the service when they are called on the AppDelegate.

Step 5

Don’t forget to call the super within all UIApplicationDelegate methods inside your delegate. The baseclass will then make sure that all services which implement said method get notified.

Background Modes

By default, SOXAppDelegate doesn’t implement the following methods:

  • - application:didReceiveRemoteNotification:fetchCompletionHandler:
  • - application:performFetchWithCompletionHandler:

These methods require additional setup in your Info.plist if you really want to use them. T prevent you from seeing warnings on the console when running the app (see issue #2) or iTunes from sending you E-Mail after you submitted your App (see issue #3) these methods are now excluded by define.

To make use of these methods, use one of the following defines (or both):

  • SOXAPPDELEGATE_BACKGROUNDMODE_REMOTENOTIFICATION (for - application:didReceiveRemoteNotification:fetchCompletionHandler:)

Enabling Background Modes

To enable one of the background modes you need to make use of the post install hook of cocoapods:

post_install do |installer_representation|
  installer_representation.project.targets.each do |target|
    target.build_configurations.each do |config|
      # enable UIBackgroundMode 'fetch'
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'SOXAPPDELEGATE_BACKGROUNDMODE_FETCH=1']

      # enable UIBackgroundMode 'remote-notification'

      # enable both

Remember to run pod install afterwards to trigger the post install hook.

Thx to johndpope for his answer demonstrating how to add GCC Preprocessor Definitions to cocoapods.


  • iOS >= 6.0


SOXAppDelegate is available through CocoaPods, to install
it simply add the following line to your Podfile:

pod "SOXAppDelegate"


Florian Krüger, [email protected]


SOXAppDelegate is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "SOXAppDelegate",
    "version": "1.1.1",
    "summary": "Service Oriented AppDelegate",
    "description": "                       An implementation of the Service Oriented AppDelegate by n                       [@clooth]('s (",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Florian Kru00fcger": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.1.1"
    "social_media_url": "",
    "platforms": {
        "ios": "5.0"
    "requires_arc": true,
    "source_files": "Classes",
    "public_header_files": "Classes/**/*.h",
    "frameworks": "UIKit"

Pin It on Pinterest

Share This