Skip to content

Commit

Permalink
Dynamic framework (#412)
Browse files Browse the repository at this point in the history
* Add Dynamic Framework

• For historical reasons, OneSignal's iOS framework was a static framework, not a dynamic framework.
• However, for some wrapper SDK's like Flutter, this causes issues with cocoapods. Any cocoapod in a project that uses use_frameworks! must not have any static dependencies
• To fix this, we are considering adding a subspec to fix the problem, but will allow some of our users to test this branch in the mean time

TODO:
• We want this dynamic framework to run on iOS devices as well as run in the iOS simulator (x86_64 and i386 architectures)
• To do this, we've made this a fat framework that contains slices for: arm64, armv7, x86_64, and i386
• However, Apple will not allow app submissions that contain fat frameworks
• So we will soon need to create a build script developers can add to their apps that strips the simulator architecture slices from the framework, so developers don't run into this issue.
• We will want to investigate if we can make this buildscript a part of our cocoapod target, or if it will require developers to add the script to their xcode projects.

* Dynamic Fat Framework

• It appears iOS framework codesigning fails if the framework uses symlinks and versions
• Changed the build script so that the SDK will put all relevant directories in the root of the framework, instead of using symlinks at the root and a Versions/A folder
• Created a new aggregate target that uses a buildscript to create a universal dynamic framework.
• The new aggregate target uses a buildscript to generate two static libraries, one for simulator (x86_64 and i386) and one for real devices (arm64 and armv7), it then uses lipo to combine these into a single dynamic fat framework

NOTE: The framework produced by the new dynamic target does not actually create its own product, it simply generates a new framework in the repo's /iOS_SDK/OneSignalSDK/Framework folder.

* Add Additional Podspec for Dynamic Framework

• We do not want to immediately switch all users to use our new fat dynamic framework
• However we do want it to be available on Cocoapods, so we've created an additional podspec & framework path
• When the project was started years back, the OneSignal-Dynamic target was actually creating a static framework, so I've renamed this target to OneSignal-Static-Framework
• The new OneSignal-Dynamic-Framework is just an aggregate framework. It does not directly produce its own product. Instead it uses a build script to produce a dynamic framework at repo/iOS_SDK/OneSignalSDK/Framework/Dynamic/OneSignal.framework
  • Loading branch information
Nightsd01 authored Sep 10, 2018
1 parent 997d20f commit ad7ce9f
Show file tree
Hide file tree
Showing 15 changed files with 594 additions and 78 deletions.
2 changes: 1 addition & 1 deletion OneSignal.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OneSignal"
s.version = "2.8.7"
s.version = "2.8.6"
s.summary = "OneSignal push notification library for mobile apps."
s.homepage = "https://onesignal.com"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
17 changes: 17 additions & 0 deletions OneSignalDynamic.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Pod::Spec.new do |s|
s.name = "OneSignalDynamic"
s.version = "2.8.6"
s.summary = "OneSignal push notification library for mobile apps."
s.homepage = "https://onesignal.com"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Joseph Kalash" => "[email protected]", "Josh Kasten" => "[email protected]" , "Brad Hesse" => "[email protected]"}

s.source = { :git => "https://github.com/OneSignal/OneSignal-iOS-SDK.git", :tag => s.version.to_s }

s.platform = :ios
s.requires_arc = true

s.ios.vendored_frameworks = 'iOS_SDK/OneSignalSDK/Framework/Dynamic/OneSignal.framework'
s.framework = 'SystemConfiguration', 'UIKit', 'UserNotifications'
end

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>

### OneSignal iOS SDK
[![CocoaPods](https://img.shields.io/cocoapods/v/OneSignal.svg)](https://cocoapods.org/pods/OneSignal) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage) [![Build Status](https://travis-ci.org/OneSignal/OneSignal-iOS-SDK.svg?branch=master)](https://travis-ci.org/OneSignal/OneSignal-iOS-SDK)
[![CocoaPods](https://img.shields.io/cocoapods/v/OneSignal.svg)](https://cocoapods.org/pods/OneSignal) [![CocoaPods](https://img.shields.io/cocoapods/dm/OneSignal.svg)](https://cocoapods.org/pods/OneSignal) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage) [![Build Status](https://travis-ci.org/OneSignal/OneSignal-iOS-SDK.svg?branch=master)](https://travis-ci.org/OneSignal/OneSignal-iOS-SDK)

---

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Loading

0 comments on commit ad7ce9f

Please sign in to comment.