Skip to content
This repository was archived by the owner on Nov 8, 2017. It is now read-only.

App Extensions

Merrick Sapsford edited this page Jun 21, 2016 · 2 revisions

To use MSSTabbedPageViewController in an App Extension, the preprocessor macro MSS_APP_EXTENSIONS must be defined. This makes the navigation bar components unavailable as they require UIKit API's that aren't available to extensions.

To achieve this:

Using CocoaPods

Add the following post_install hook to the end of your Podfile:

post_install do |installer|
  # NOTE: If you are using a CocoaPods version prior to 0.38, replace `pods_project` with `project` on the below line
  installer.pods_project.targets.each do |target|
    if target.name.end_with? "MSSTabbedPageViewController"
      target.build_configurations.each do |build_configuration|
        if build_configuration.build_settings['APPLICATION_EXTENSION_API_ONLY'] == 'YES'
          build_configuration.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'MSS_APP_EXTENSIONS=1']
        end
      end
    end
  end
end

The above post_install hook will define the macro MSS_APP_EXTENSIONS=1 for every build configuration on all MSSTabbedPageViewController targets in the generated Pods project that are used by App Extensions.

Direct Xcode integration

  1. In Xcode, click on your Project
  2. Click on the Target for your App Extension
  3. Click Build Settings
  4. Find (or search) Preprocessor Macros
  5. For all build configurations (Debug & Release) add the macro: MSS_APP_EXTENSIONS=1

Clone this wiki locally