This repository was archived by the owner on Nov 8, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
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:
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
endThe 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.
- In Xcode, click on your Project
- Click on the Target for your App Extension
- Click Build Settings
- Find (or search) Preprocessor Macros
- For all build configurations (Debug & Release) add the macro:
MSS_APP_EXTENSIONS=1