-
-
Notifications
You must be signed in to change notification settings - Fork 599
Work with application extension
Phi Mage edited this page Nov 10, 2015
·
1 revision
UIApplication.sharedApplication()
is not accessible from iOS application extension
Do deactivate codes that use UIApplication.sharedApplication()
your must add -D OAUTH_APP_EXTENSIONS
to your OTHER_SWIFT_FLAGS
on OAuthSwift target
You must also set a custom authorize_url_handler
to your oauthswift object, the default one will not work (You can try the ExtensionContextURLHandler
)
Add at the end of your podfile something like that
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "OAuthSwift"
puts "Updating #{target.name} OTHER_SWIFT_FLAGS"
target.build_configurations.each do |config|
config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['$(inherited)']
if !config.build_settings['OTHER_SWIFT_FLAGS'].include? " \"-D\" \"OAUTH_APP_EXTENSIONS\""
config.build_settings['OTHER_SWIFT_FLAGS'] << " \"-D\" \"OAUTH_APP_EXTENSIONS\""
end
end
end
end
end
[ [ [