@algocare/react-native-code-push 9.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/AlertAdapter.js +24 -0
  2. package/CONTRIBUTING.md +134 -0
  3. package/CodePush.js +778 -0
  4. package/CodePush.podspec +27 -0
  5. package/LICENSE.md +13 -0
  6. package/README.md +491 -0
  7. package/SECURITY.md +41 -0
  8. package/android/app/build.gradle +31 -0
  9. package/android/app/proguard-rules.pro +25 -0
  10. package/android/app/src/main/AndroidManifest.xml +6 -0
  11. package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +441 -0
  12. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +37 -0
  13. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +35 -0
  14. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +102 -0
  15. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInstallMode.java +16 -0
  16. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +12 -0
  17. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidUpdateException.java +7 -0
  18. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushMalformedDataException.java +12 -0
  19. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +714 -0
  20. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNotInitializedException.java +12 -0
  21. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushTelemetryManager.java +175 -0
  22. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUnknownException.java +12 -0
  23. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +383 -0
  24. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateState.java +15 -0
  25. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +268 -0
  26. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java +238 -0
  27. package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgress.java +30 -0
  28. package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgressCallback.java +5 -0
  29. package/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java +203 -0
  30. package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +17 -0
  31. package/android/app/src/main/java/com/microsoft/codepush/react/SettingsManager.java +173 -0
  32. package/android/app/src/main/java/com/microsoft/codepush/react/TLSSocketFactory.java +72 -0
  33. package/android/build.gradle +21 -0
  34. package/android/codepush.gradle +162 -0
  35. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  36. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  37. package/android/gradle.properties +20 -0
  38. package/android/gradlew +164 -0
  39. package/android/gradlew.bat +90 -0
  40. package/android/settings.gradle +1 -0
  41. package/babel.config.js +3 -0
  42. package/cli/commands/bundleCommand/bundleCodePush.js +57 -0
  43. package/cli/commands/bundleCommand/index.js +29 -0
  44. package/cli/commands/createHistoryCommand/createReleaseHistory.js +53 -0
  45. package/cli/commands/createHistoryCommand/index.js +29 -0
  46. package/cli/commands/releaseCommand/addToReleaseHistory.js +75 -0
  47. package/cli/commands/releaseCommand/index.js +66 -0
  48. package/cli/commands/releaseCommand/release.js +109 -0
  49. package/cli/commands/showHistoryCommand/index.js +29 -0
  50. package/cli/commands/updateHistoryCommand/index.js +50 -0
  51. package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +62 -0
  52. package/cli/constant.js +6 -0
  53. package/cli/functions/getReactTempDir.js +16 -0
  54. package/cli/functions/makeCodePushBundle.js +28 -0
  55. package/cli/functions/prepareToBundleJS.js +12 -0
  56. package/cli/functions/runHermesEmitBinaryCommand.js +213 -0
  57. package/cli/functions/runReactNativeBundleCommand.js +59 -0
  58. package/cli/index.js +43 -0
  59. package/cli/utils/file-utils.js +42 -0
  60. package/cli/utils/fsUtils.js +49 -0
  61. package/cli/utils/hash-utils.js +227 -0
  62. package/cli/utils/promisfied-fs.js +29 -0
  63. package/cli/utils/showLogo.js +23 -0
  64. package/cli/utils/zip.js +89 -0
  65. package/code-push.config.example.supabase.ts +114 -0
  66. package/docs/api-android.md +83 -0
  67. package/docs/api-ios.md +31 -0
  68. package/docs/api-js.md +592 -0
  69. package/docs/multi-deployment-testing-android.md +148 -0
  70. package/docs/multi-deployment-testing-ios.md +59 -0
  71. package/docs/setup-android.md +482 -0
  72. package/docs/setup-ios.md +280 -0
  73. package/eslint.config.mjs +32 -0
  74. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +34 -0
  75. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +252 -0
  76. package/ios/CodePush/Base64/README.md +47 -0
  77. package/ios/CodePush/CodePush.h +235 -0
  78. package/ios/CodePush/CodePush.m +1121 -0
  79. package/ios/CodePush/CodePushConfig.m +116 -0
  80. package/ios/CodePush/CodePushDownloadHandler.m +130 -0
  81. package/ios/CodePush/CodePushErrorUtils.m +20 -0
  82. package/ios/CodePush/CodePushPackage.m +602 -0
  83. package/ios/CodePush/CodePushTelemetryManager.m +175 -0
  84. package/ios/CodePush/CodePushUpdateUtils.m +376 -0
  85. package/ios/CodePush/CodePushUtils.m +9 -0
  86. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +69 -0
  87. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +16 -0
  88. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +51 -0
  89. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +15 -0
  90. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +55 -0
  91. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +24 -0
  92. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +41 -0
  93. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +28 -0
  94. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +205 -0
  95. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +103 -0
  96. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +322 -0
  97. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +37 -0
  98. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +145 -0
  99. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +35 -0
  100. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +551 -0
  101. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +23 -0
  102. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +43 -0
  103. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +230 -0
  104. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +31 -0
  105. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +113 -0
  106. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +38 -0
  107. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +500 -0
  108. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +18 -0
  109. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +214 -0
  110. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +23 -0
  111. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +29 -0
  112. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +19 -0
  113. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +68 -0
  114. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +18 -0
  115. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +72 -0
  116. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +67 -0
  117. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +111 -0
  118. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +119 -0
  119. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +307 -0
  120. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +94 -0
  121. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +619 -0
  122. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +164 -0
  123. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +514 -0
  124. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +24 -0
  125. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +11 -0
  126. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +52 -0
  127. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +5 -0
  128. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +28 -0
  129. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +70 -0
  130. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +22 -0
  131. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +34 -0
  132. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +73 -0
  133. package/ios/CodePush/JWT/LICENSE +19 -0
  134. package/ios/CodePush/JWT/README.md +489 -0
  135. package/ios/CodePush/RCTConvert+CodePushInstallMode.m +20 -0
  136. package/ios/CodePush/RCTConvert+CodePushUpdateState.m +20 -0
  137. package/ios/CodePush/SSZipArchive/Common.h +81 -0
  138. package/ios/CodePush/SSZipArchive/README.md +1 -0
  139. package/ios/CodePush/SSZipArchive/SSZipArchive.h +76 -0
  140. package/ios/CodePush/SSZipArchive/SSZipArchive.m +691 -0
  141. package/ios/CodePush/SSZipArchive/aes/aes.h +198 -0
  142. package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +541 -0
  143. package/ios/CodePush/SSZipArchive/aes/aescrypt.c +294 -0
  144. package/ios/CodePush/SSZipArchive/aes/aeskey.c +548 -0
  145. package/ios/CodePush/SSZipArchive/aes/aesopt.h +739 -0
  146. package/ios/CodePush/SSZipArchive/aes/aestab.c +391 -0
  147. package/ios/CodePush/SSZipArchive/aes/aestab.h +173 -0
  148. package/ios/CodePush/SSZipArchive/aes/brg_endian.h +126 -0
  149. package/ios/CodePush/SSZipArchive/aes/brg_types.h +219 -0
  150. package/ios/CodePush/SSZipArchive/aes/entropy.c +54 -0
  151. package/ios/CodePush/SSZipArchive/aes/entropy.h +16 -0
  152. package/ios/CodePush/SSZipArchive/aes/fileenc.c +144 -0
  153. package/ios/CodePush/SSZipArchive/aes/fileenc.h +121 -0
  154. package/ios/CodePush/SSZipArchive/aes/hmac.c +145 -0
  155. package/ios/CodePush/SSZipArchive/aes/hmac.h +103 -0
  156. package/ios/CodePush/SSZipArchive/aes/prng.c +155 -0
  157. package/ios/CodePush/SSZipArchive/aes/prng.h +82 -0
  158. package/ios/CodePush/SSZipArchive/aes/pwd2key.c +103 -0
  159. package/ios/CodePush/SSZipArchive/aes/pwd2key.h +57 -0
  160. package/ios/CodePush/SSZipArchive/aes/sha1.c +258 -0
  161. package/ios/CodePush/SSZipArchive/aes/sha1.h +73 -0
  162. package/ios/CodePush/SSZipArchive/minizip/crypt.h +130 -0
  163. package/ios/CodePush/SSZipArchive/minizip/ioapi.c +369 -0
  164. package/ios/CodePush/SSZipArchive/minizip/ioapi.h +175 -0
  165. package/ios/CodePush/SSZipArchive/minizip/mztools.c +284 -0
  166. package/ios/CodePush/SSZipArchive/minizip/mztools.h +31 -0
  167. package/ios/CodePush/SSZipArchive/minizip/unzip.c +1839 -0
  168. package/ios/CodePush/SSZipArchive/minizip/unzip.h +248 -0
  169. package/ios/CodePush/SSZipArchive/minizip/zip.c +1910 -0
  170. package/ios/CodePush/SSZipArchive/minizip/zip.h +202 -0
  171. package/ios/CodePush.xcodeproj/project.pbxproj +937 -0
  172. package/ios/CodePush.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  173. package/ios/CodePush.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  174. package/logging.js +6 -0
  175. package/package-mixins.js +61 -0
  176. package/package.json +84 -0
  177. package/react-native.config.js +12 -0
  178. package/scripts/generateBundledResourcesHash.js +125 -0
  179. package/scripts/getFilesInFolder.js +19 -0
  180. package/scripts/recordFilesBeforeBundleCommand.js +41 -0
  181. package/tsconfig.json +14 -0
  182. package/tslint.json +32 -0
  183. package/typings/react-native-code-push.d.ts +589 -0
  184. package/versioning/BaseVersioning.js +126 -0
  185. package/versioning/BaseVersioning.test.js +15 -0
  186. package/versioning/IncrementalVersioning.js +9 -0
  187. package/versioning/IncrementalVersioning.test.js +186 -0
  188. package/versioning/SemverVersioning.js +10 -0
  189. package/versioning/SemverVersioning.test.js +205 -0
  190. package/versioning/index.js +7 -0
@@ -0,0 +1,280 @@
1
+ ## iOS Setup
2
+
3
+ Once you've acquired the CodePush plugin, you need to integrate it into the Xcode project of your React Native app and configure it correctly. To do this, take the following steps:
4
+
5
+ ### Plugin Installation and Configuration for React Native 0.60 version and above (iOS)
6
+
7
+ 1. Run `cd ios && pod install && cd ..` to install all the necessary CocoaPods dependencies.
8
+
9
+ 2. Open up the `AppDelegate.m` file, and add an import statement for the CodePush headers:
10
+
11
+ ```objective-c
12
+ #import <CodePush/CodePush.h>
13
+ ```
14
+
15
+ 3. Find the following line of code, which sets the source URL for bridge for production releases:
16
+
17
+ ```objective-c
18
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
19
+ ```
20
+
21
+ 4. Replace it with this line:
22
+
23
+ ```objective-c
24
+ return [CodePush bundleURL];
25
+ ```
26
+ This change configures your app to always load the most recent version of your app's JS bundle. On the first launch, this will correspond to the file that was compiled with the app. However, after an update has been pushed via CodePush, this will return the location of the most recently installed update.
27
+
28
+ *NOTE: The `bundleURL` method assumes your app's JS bundle is named `main.jsbundle`. If you have configured your app to use a different file name, simply call the `bundleURLForResource:` method (which assumes you're using the `.jsbundle` extension) or `bundleURLForResource:withExtension:` method instead, in order to overwrite that default behavior*
29
+
30
+ Typically, you're only going to want to use CodePush to resolve your JS bundle location within release builds, and therefore, we recommend using the `DEBUG` pre-processor macro to dynamically switch between using the packager server and CodePush, depending on whether you are debugging or not. This will make it much simpler to ensure you get the right behavior you want in production, while still being able to use the Chrome Dev Tools, live reload, etc. at debug-time.
31
+
32
+ Your `sourceURLForBridge` method should look like this:
33
+
34
+ ```objective-c
35
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
36
+ {
37
+ #if DEBUG
38
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
39
+ #else
40
+ return [CodePush bundleURL];
41
+ #endif
42
+ }
43
+ ```
44
+
45
+ 5. Add the Deployment key to `Info.plist`:
46
+
47
+ To let the CodePush runtime know which deployment it should query for updates against, open your app's `Info.plist` file and add a new entry named `CodePushDeploymentKey`, whose value is the key of the deployment you want to configure this app against (like the key for the `Staging` deployment for the `FooBar` app). You can retrieve this value by running `appcenter codepush deployment list -a <ownerName>/<appName> -k` in the AppCenter CLI (the `-k` flag is necessary since keys aren't displayed by default) and copying the value of the `Key` column which corresponds to the deployment you want to use (see below). Note that using the deployment's name (like Staging) will not work. That "friendly name" is intended only for authenticated management usage from the CLI, and not for public consumption within your app.
48
+
49
+ ![Deployment list](https://cloud.githubusercontent.com/assets/116461/11601733/13011d5e-9a8a-11e5-9ce2-b100498ffb34.png)
50
+
51
+ In order to effectively make use of the `Staging` and `Production` deployments that were created along with your CodePush app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of CodePush into production.
52
+
53
+ *Note: If you need to dynamically use a different deployment, you can also override your deployment key in JS code using [Code-Push options](./api-js.md#CodePushOptions)*
54
+
55
+ ### Plugin Installation for React Native lower than 0.60 (iOS)
56
+
57
+ In order to accommodate as many developer preferences as possible, the CodePush plugin supports iOS installation via three mechanisms:
58
+
59
+ 1. [**RNPM**](#plugin-installation-ios---rnpm) - [React Native Package Manager (RNPM)](https://github.com/rnpm/rnpm) is an awesome tool that provides the simplest installation experience possible for React Native plugins. If you're already using it, or you want to use it, then we recommend this approach.
60
+
61
+ 2. [**CocoaPods**](#plugin-installation-ios---cocoapods) - If you're building a native iOS app that is embedding React Native into it, or you simply prefer using [CocoaPods](https://cocoapods.org), then we recommend using the Podspec file that we ship as part of our plugin.
62
+
63
+ 3. [**"Manual"**](#plugin-installation-ios---manual) - If you don't want to depend on any additional tools or are fine with a few extra installation steps (it's a one-time thing), then go with this approach.
64
+
65
+ #### Plugin Installation (iOS - RNPM)
66
+
67
+ 1. As of v0.27 of React Native, `rnpm link` has already been merged into the React Native CLI. Simply run:
68
+ ```
69
+ react-native link react-native-code-push
70
+ ```
71
+
72
+ If your app uses a version of React Native that is lower than v0.27, run the following:
73
+ ```
74
+ rnpm link react-native-code-push
75
+ ```
76
+
77
+ *Note: If you don't already have RNPM installed, you can do so by simply running `npm i -g rnpm` and then executing the above command. If you already have RNPM installed, make sure you have v1.9.0+ in order to benefit from this one step install.*
78
+
79
+ 2. You will be prompted for the deployment key you'd like to use. If you don't already have it, you can retrieve this value by running `appcenter codepush deployment list -a <ownerName>/<appName> -k`, or you can choose to ignore it (by simply hitting `<ENTER>`) and add it in later. To get started, we would recommend just using your `Staging` deployment key, so that you can test out the CodePush end-to-end.
80
+
81
+ And that's it! Isn't RNPM awesome? :)
82
+
83
+ #### Plugin Installation (iOS - CocoaPods)
84
+
85
+ 1. Add the ReactNative and CodePush plugin dependencies to your `Podfile`, pointing at the path where NPM installed it
86
+
87
+ ```
88
+ # React Native requirements
89
+ pod 'React', :path => '../node_modules/react-native', :subspecs => [
90
+ 'Core',
91
+ 'CxxBridge', # Include this for RN >= 0.47
92
+ 'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
93
+ 'RCTText',
94
+ 'RCTNetwork',
95
+ 'RCTWebSocket', # Needed for debugging
96
+ 'RCTAnimation', # Needed for FlatList and animations running on native UI thread
97
+ # Add any other subspecs you want to use in your project
98
+ ]
99
+ # Explicitly include Yoga if you are using RN >= 0.42.0
100
+ pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
101
+ pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
102
+ pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
103
+ pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
104
+
105
+ # CodePush plugin dependency
106
+ pod 'CodePush', :path => '../node_modules/react-native-code-push'
107
+ ```
108
+
109
+ *NOTE: The above path needs to be relative to your app's `Podfile`, so adjust it as necessary.*
110
+
111
+ *NOTE: `JWT` library should be >= version 3.0.x*
112
+
113
+ 2. Run `pod install`
114
+
115
+ *NOTE: The CodePush `.podspec` depends on the `React` pod, and so in order to ensure that it can correctly use the version of React Native that your app is built with, please make sure to define the `React` dependency in your app's `Podfile` as explained [here](https://facebook.github.io/react-native/docs/integration-with-existing-apps.html#podfile).*
116
+
117
+ #### Plugin Installation (iOS - Manual)
118
+
119
+ 1. Open your app's Xcode project
120
+
121
+ 2. Find the `CodePush.xcodeproj` file within the `node_modules/react-native-code-push/ios` directory (or `node_modules/react-native-code-push` for <=`1.7.3-beta` installations) and drag it into the `Libraries` node in Xcode
122
+
123
+ ![Add CodePush to project](https://cloud.githubusercontent.com/assets/8598682/13368613/c5c21422-dca0-11e5-8594-c0ec5bde9d81.png)
124
+
125
+ 3. Select the project node in Xcode and select the "Build Phases" tab of your project configuration.
126
+
127
+ 4. Drag `libCodePush.a` from `Libraries/CodePush.xcodeproj/Products` into the "Link Binary With Libraries" section of your project's "Build Phases" configuration.
128
+
129
+ ![Link CodePush during build](https://cloud.githubusercontent.com/assets/516559/10322221/a75ea066-6c31-11e5-9d88-ff6f6a4d6968.png)
130
+
131
+ 5. Click the plus sign underneath the "Link Binary With Libraries" list and select the `libz.tbd` library underneath the `iOS 9.1` node.
132
+
133
+ ![Libz reference](https://cloud.githubusercontent.com/assets/116461/11605042/6f786e64-9aaa-11e5-8ca7-14b852f808b1.png)
134
+
135
+ *Note: Alternatively, if you prefer, you can add the `-lz` flag to the `Other Linker Flags` field in the `Linking` section of the `Build Settings`.*
136
+
137
+
138
+ ### Plugin Configuration for React Native lower than 0.60 (iOS)
139
+
140
+ *NOTE: If you used RNPM or `react-native link` to automatically link the plugin, these steps have already been done for you so you may skip this section.*
141
+
142
+ Once your Xcode project has been setup to build/link the CodePush plugin, you need to configure your app to consult CodePush for the location of your JS bundle, since it is responsible for synchronizing it with updates that are released to the CodePush server. To do this, perform the following steps:
143
+
144
+ 1. Open up the `AppDelegate.m` file, and add an import statement for the CodePush headers:
145
+
146
+ ```objective-c
147
+ #import <CodePush/CodePush.h>
148
+ ```
149
+
150
+ For React Native 0.59 - 0.59.10:
151
+
152
+ 2. Find the following line of code, which sets the source URL for bridge for production releases:
153
+
154
+ ```objective-c
155
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
156
+ ```
157
+
158
+ 3. Replace it with this line:
159
+
160
+ ```objective-c
161
+ return [CodePush bundleURL];
162
+ ```
163
+
164
+ For React Native 0.58 and below:
165
+
166
+ 2. Find the following line of code, which loads your JS Bundle from the app binary for production releases:
167
+
168
+ ```objective-c
169
+ jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
170
+ ```
171
+
172
+ 3. Replace it with this line:
173
+
174
+ ```objective-c
175
+ jsCodeLocation = [CodePush bundleURL];
176
+ ```
177
+
178
+ This change configures your app to always load the most recent version of your app's JS bundle. On the first launch, this will correspond to the file that was compiled with the app. However, after an update has been pushed via CodePush, this will return the location of the most recently installed update.
179
+
180
+ *NOTE: The `bundleURL` method assumes your app's JS bundle is named `main.jsbundle`. If you have configured your app to use a different file name, simply call the `bundleURLForResource:` method (which assumes you're using the `.jsbundle` extension) or `bundleURLForResource:withExtension:` method instead, in order to overwrite that default behavior*
181
+
182
+ Typically, you're only going to want to use CodePush to resolve your JS bundle location within release builds, and therefore, we recommend using the `DEBUG` pre-processor macro to dynamically switch between using the packager server and CodePush, depending on whether you are debugging or not. This will make it much simpler to ensure you get the right behavior you want in production, while still being able to use the Chrome Dev Tools, live reload, etc. at debug-time.
183
+
184
+ For React Native 0.59 - 0.59.10:
185
+
186
+ ```objective-c
187
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
188
+ {
189
+ #if DEBUG
190
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
191
+ #else
192
+ return [CodePush bundleURL];
193
+ #endif
194
+ }
195
+ ```
196
+
197
+ For React Native 0.49 - 0.58:
198
+
199
+ ```objective-c
200
+ NSURL *jsCodeLocation;
201
+
202
+ #ifdef DEBUG
203
+ jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
204
+ #else
205
+ jsCodeLocation = [CodePush bundleURL];
206
+ #endif
207
+ ```
208
+
209
+ For React Native 0.48 and below:
210
+
211
+ ```objective-c
212
+ NSURL *jsCodeLocation;
213
+
214
+ #ifdef DEBUG
215
+ jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
216
+ #else
217
+ jsCodeLocation = [CodePush bundleURL];
218
+ #endif
219
+ ```
220
+
221
+ To let the CodePush runtime know which deployment it should query for updates against, open your app's `Info.plist` file and add a new entry named `CodePushDeploymentKey`, whose value is the key of the deployment you want to configure this app against (like the key for the `Staging` deployment for the `FooBar` app). You can retrieve this value by running `appcenter codepush deployment list -a <ownerName>/<appName> -k` in the AppCenter CLI (the `-k` flag is necessary since keys aren't displayed by default) and copying the value of the `Key` column which corresponds to the deployment you want to use (see below). Note that using the deployment's name (like Staging) will not work. That "friendly name" is intended only for authenticated management usage from the CLI, and not for public consumption within your app.
222
+
223
+ ![Deployment list](https://cloud.githubusercontent.com/assets/116461/11601733/13011d5e-9a8a-11e5-9ce2-b100498ffb34.png)
224
+
225
+ In order to effectively make use of the `Staging` and `Production` deployments that were created along with your CodePush app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of CodePush into production.
226
+
227
+ ### HTTP exception domains configuration (iOS)
228
+
229
+ CodePush plugin makes HTTPS requests to the following domains:
230
+
231
+ - codepush.appcenter.ms
232
+ - codepush.blob.core.windows.net
233
+ - codepushupdates.azureedge.net
234
+
235
+ If you want to change the default HTTP security configuration for any of these domains, you have to define the [`NSAppTransportSecurity` (ATS)][ats] configuration inside your __Info.plist__ file:
236
+
237
+ ```xml
238
+ <plist version="1.0">
239
+ <dict>
240
+ <!-- ...other configs... -->
241
+
242
+ <key>NSAppTransportSecurity</key>
243
+ <dict>
244
+ <key>NSExceptionDomains</key>
245
+ <dict>
246
+ <key>codepush.appcenter.ms</key>
247
+ <dict><!-- read the ATS Apple Docs for available options --></dict>
248
+ </dict>
249
+ </dict>
250
+
251
+ <!-- ...other configs... -->
252
+ </dict>
253
+ </plist>
254
+ ```
255
+
256
+ Before doing anything, please [read the docs][ats] first.
257
+
258
+ [ats]: https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33
259
+
260
+ ### Code Signing setup
261
+
262
+ Starting with CLI version **2.1.0** you can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant code-push documentation section](https://github.com/microsoft/code-push/tree/v3.0.1/cli#code-signing).
263
+
264
+ In order to configure Public Key for bundle verification you need to add record in `Info.plist` with name `CodePushPublicKey` and string value of public key content. Example:
265
+
266
+ ```xml
267
+ <plist version="1.0">
268
+ <dict>
269
+ <!-- ...other configs... -->
270
+
271
+ <key>CodePushPublicKey</key>
272
+ <string>-----BEGIN PUBLIC KEY-----
273
+ MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANkWYydPuyOumR/sn2agNBVDnzyRpM16NAUpYPGxNgjSEp0etkDNgzzdzyvyl+OsAGBYF3jCxYOXozum+uV5hQECAwEAAQ==
274
+ -----END PUBLIC KEY-----</string>
275
+
276
+ <!-- ...other configs... -->
277
+ </dict>
278
+ </plist>
279
+ ```
280
+
@@ -0,0 +1,32 @@
1
+ import globals from "globals";
2
+ import pluginJs from "@eslint/js";
3
+ import tseslint from "typescript-eslint";
4
+ import pluginReact from "eslint-plugin-react";
5
+
6
+
7
+ export default [
8
+ {files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
9
+ {languageOptions: { globals: {
10
+ ...globals.node,
11
+ ...globals.mocha,
12
+ ...globals.browser,
13
+ ...globals.jest
14
+ } }},
15
+ pluginJs.configs.recommended,
16
+ ...tseslint.configs.recommended,
17
+ pluginReact.configs.flat.recommended,
18
+ {"rules": {
19
+ "@typescript-eslint/no-require-imports": "warn",
20
+ "@typescript-eslint/no-unused-vars": "warn",
21
+ "@typescript-eslint/no-unused-expressions": "warn",
22
+ "no-empty": "warn",
23
+ "@typescript-eslint/no-explicit-any": "warn",
24
+ "no-var": "warn",
25
+ "@typescript-eslint/no-this-alias": "warn",
26
+ "@typescript-eslint/no-empty-object-type": "warn",
27
+ "react/no-deprecated": "warn",
28
+ "no-extra-boolean-cast": "warn",
29
+ "no-useless-escape": "warn",
30
+ "no-control-regex": "warn",
31
+ }}
32
+ ];
@@ -0,0 +1,34 @@
1
+ //
2
+ // MF_Base64Additions.h
3
+ // Base64 -- RFC 4648 compatible implementation
4
+ // see http://www.ietf.org/rfc/rfc4648.txt for more details
5
+ //
6
+ // Designed to be compiled with Automatic Reference Counting
7
+ //
8
+ // Created by Dave Poirier on 2012-06-14.
9
+ // Public Domain
10
+ // Hosted at https://github.com/ekscrypto/Base64
11
+ //
12
+
13
+ #import <Foundation/Foundation.h>
14
+
15
+ @interface NSString (Base64Addition)
16
+ +(NSString *)stringFromBase64String:(NSString *)base64String;
17
+ +(NSString *)stringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString;
18
+ -(NSString *)base64String;
19
+ -(NSString *)base64UrlEncodedString;
20
+ @end
21
+
22
+ @interface NSData (Base64Addition)
23
+ +(NSData *)dataWithBase64String:(NSString *)base64String;
24
+ +(NSData *)dataWithBase64UrlEncodedString:(NSString *)base64UrlEncodedString;
25
+ -(NSString *)base64String;
26
+ -(NSString *)base64UrlEncodedString;
27
+ @end
28
+
29
+ @interface MF_Base64Codec : NSObject
30
+ +(NSData *)dataFromBase64String:(NSString *)base64String;
31
+ +(NSString *)base64StringFromData:(NSData *)data;
32
+ +(NSString *)base64UrlEncodedStringFromBase64String:(NSString *)base64String;
33
+ +(NSString *)base64StringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString;
34
+ @end
@@ -0,0 +1,252 @@
1
+ //
2
+ // MF_Base64Additions.m
3
+ // Base64 -- RFC 4648 compatible implementation
4
+ // see http://www.ietf.org/rfc/rfc4648.txt for more details
5
+ //
6
+ // Designed to be compiled with Automatic Reference Counting
7
+ //
8
+ // Created by Dave Poirier on 2012-06-14.
9
+ // Public Domain
10
+ // Hosted at https://github.com/ekscrypto/Base64
11
+ //
12
+
13
+ #import "MF_Base64Additions.h"
14
+
15
+ @implementation MF_Base64Codec
16
+
17
+ +(NSString *)base64StringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString
18
+ {
19
+ NSString *s = base64UrlEncodedString;
20
+ s = [s stringByReplacingOccurrencesOfString:@"-" withString:@"+"];
21
+ s = [s stringByReplacingOccurrencesOfString:@"_" withString:@"/"];
22
+ switch (s.length % 4) {
23
+ case 2:
24
+ s = [s stringByAppendingString:@"=="];
25
+ break;
26
+ case 3:
27
+ s = [s stringByAppendingString:@"="];
28
+ break;
29
+ default:
30
+ break;
31
+ }
32
+ return s;
33
+ }
34
+
35
+ +(NSString *)base64UrlEncodedStringFromBase64String:(NSString *)base64String
36
+ {
37
+ NSString *s = base64String;
38
+ s = [s stringByReplacingOccurrencesOfString:@"=" withString:@""];
39
+ s = [s stringByReplacingOccurrencesOfString:@"+" withString:@"-"];
40
+ s = [s stringByReplacingOccurrencesOfString:@"/" withString:@"_"];
41
+ return s;
42
+ }
43
+
44
+ +(NSData *)dataFromBase64String:(NSString *)encoding
45
+ {
46
+ NSData *data = nil;
47
+ unsigned char *decodedBytes = NULL;
48
+ @try {
49
+ #define __ 255
50
+ static char decodingTable[256] = {
51
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x00 - 0x0F
52
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x10 - 0x1F
53
+ __,__,__,__, __,__,__,__, __,__,__,62, __,__,__,63, // 0x20 - 0x2F
54
+ 52,53,54,55, 56,57,58,59, 60,61,__,__, __, 0,__,__, // 0x30 - 0x3F
55
+ __, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, // 0x40 - 0x4F
56
+ 15,16,17,18, 19,20,21,22, 23,24,25,__, __,__,__,__, // 0x50 - 0x5F
57
+ __,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, // 0x60 - 0x6F
58
+ 41,42,43,44, 45,46,47,48, 49,50,51,__, __,__,__,__, // 0x70 - 0x7F
59
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x80 - 0x8F
60
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x90 - 0x9F
61
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xA0 - 0xAF
62
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xB0 - 0xBF
63
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xC0 - 0xCF
64
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xD0 - 0xDF
65
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xE0 - 0xEF
66
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xF0 - 0xFF
67
+ };
68
+ encoding = [encoding stringByReplacingOccurrencesOfString:@"=" withString:@""];
69
+ NSData *encodedData = [encoding dataUsingEncoding:NSASCIIStringEncoding];
70
+ unsigned char *encodedBytes = (unsigned char *)[encodedData bytes];
71
+
72
+ NSUInteger encodedLength = [encodedData length];
73
+ if( encodedLength >= (NSUIntegerMax - 3) ) return nil; // NSUInteger overflow check
74
+ NSUInteger encodedBlocks = (encodedLength+3) >> 2;
75
+ NSUInteger expectedDataLength = encodedBlocks * 3;
76
+
77
+ unsigned char decodingBlock[4];
78
+
79
+ decodedBytes = malloc(expectedDataLength);
80
+ if( decodedBytes != NULL ) {
81
+
82
+ NSUInteger i = 0;
83
+ NSUInteger j = 0;
84
+ NSUInteger k = 0;
85
+ unsigned char c;
86
+ while( i < encodedLength ) {
87
+ c = decodingTable[encodedBytes[i]];
88
+ i++;
89
+ if( c != __ ) {
90
+ decodingBlock[j] = c;
91
+ j++;
92
+ if( j == 4 ) {
93
+ decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4);
94
+ decodedBytes[k+1] = (decodingBlock[1] << 4) | (decodingBlock[2] >> 2);
95
+ decodedBytes[k+2] = (decodingBlock[2] << 6) | (decodingBlock[3]);
96
+ j = 0;
97
+ k += 3;
98
+ }
99
+ }
100
+ }
101
+
102
+ // Process left over bytes, if any
103
+ if( j == 3 ) {
104
+ decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4);
105
+ decodedBytes[k+1] = (decodingBlock[1] << 4) | (decodingBlock[2] >> 2);
106
+ k += 2;
107
+ } else if( j == 2 ) {
108
+ decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4);
109
+ k += 1;
110
+ }
111
+ data = [[NSData alloc] initWithBytes:decodedBytes length:k];
112
+ }
113
+ }
114
+ @catch (NSException *exception) {
115
+ data = nil;
116
+ NSLog(@"WARNING: error occured while decoding base 32 string: %@", exception);
117
+ }
118
+ @finally {
119
+ if( decodedBytes != NULL ) {
120
+ free( decodedBytes );
121
+ }
122
+ }
123
+ return data;
124
+ }
125
+ +(NSString *)base64StringFromData:(NSData *)data
126
+ {
127
+ NSString *encoding = nil;
128
+ unsigned char *encodingBytes = NULL;
129
+ @try {
130
+ static char encodingTable[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
131
+ static NSUInteger paddingTable[] = {0,2,1};
132
+ // Table 1: The Base 64 Alphabet
133
+ //
134
+ // Value Encoding Value Encoding Value Encoding Value Encoding
135
+ // 0 A 17 R 34 i 51 z
136
+ // 1 B 18 S 35 j 52 0
137
+ // 2 C 19 T 36 k 53 1
138
+ // 3 D 20 U 37 l 54 2
139
+ // 4 E 21 V 38 m 55 3
140
+ // 5 F 22 W 39 n 56 4
141
+ // 6 G 23 X 40 o 57 5
142
+ // 7 H 24 Y 41 p 58 6
143
+ // 8 I 25 Z 42 q 59 7
144
+ // 9 J 26 a 43 r 60 8
145
+ // 10 K 27 b 44 s 61 9
146
+ // 11 L 28 c 45 t 62 +
147
+ // 12 M 29 d 46 u 63 /
148
+ // 13 N 30 e 47 v
149
+ // 14 O 31 f 48 w (pad) =
150
+ // 15 P 32 g 49 x
151
+ // 16 Q 33 h 50 y
152
+
153
+ NSUInteger dataLength = [data length];
154
+ NSUInteger encodedBlocks = dataLength / 3;
155
+ if( (encodedBlocks + 1) >= (NSUIntegerMax / 4) ) return nil; // NSUInteger overflow check
156
+ NSUInteger padding = paddingTable[dataLength % 3];
157
+ if( padding > 0 ) encodedBlocks++;
158
+ NSUInteger encodedLength = encodedBlocks * 4;
159
+
160
+ encodingBytes = malloc(encodedLength);
161
+ if( encodingBytes != NULL ) {
162
+ NSUInteger rawBytesToProcess = dataLength;
163
+ NSUInteger rawBaseIndex = 0;
164
+ NSUInteger encodingBaseIndex = 0;
165
+ unsigned char *rawBytes = (unsigned char *)[data bytes];
166
+ unsigned char rawByte1, rawByte2, rawByte3;
167
+ while( rawBytesToProcess >= 3 ) {
168
+ rawByte1 = rawBytes[rawBaseIndex];
169
+ rawByte2 = rawBytes[rawBaseIndex+1];
170
+ rawByte3 = rawBytes[rawBaseIndex+2];
171
+ encodingBytes[encodingBaseIndex] = encodingTable[((rawByte1 >> 2) & 0x3F)];
172
+ encodingBytes[encodingBaseIndex+1] = encodingTable[((rawByte1 << 4) & 0x30) | ((rawByte2 >> 4) & 0x0F) ];
173
+ encodingBytes[encodingBaseIndex+2] = encodingTable[((rawByte2 << 2) & 0x3C) | ((rawByte3 >> 6) & 0x03) ];
174
+ encodingBytes[encodingBaseIndex+3] = encodingTable[(rawByte3 & 0x3F)];
175
+
176
+ rawBaseIndex += 3;
177
+ encodingBaseIndex += 4;
178
+ rawBytesToProcess -= 3;
179
+ }
180
+ rawByte2 = 0;
181
+ switch (dataLength-rawBaseIndex) {
182
+ case 2:
183
+ rawByte2 = rawBytes[rawBaseIndex+1];
184
+ case 1:
185
+ rawByte1 = rawBytes[rawBaseIndex];
186
+ encodingBytes[encodingBaseIndex] = encodingTable[((rawByte1 >> 2) & 0x3F)];
187
+ encodingBytes[encodingBaseIndex+1] = encodingTable[((rawByte1 << 4) & 0x30) | ((rawByte2 >> 4) & 0x0F) ];
188
+ encodingBytes[encodingBaseIndex+2] = encodingTable[((rawByte2 << 2) & 0x3C) ];
189
+ // we can skip rawByte3 since we have a partial block it would always be 0
190
+ break;
191
+ }
192
+ // compute location from where to begin inserting padding, it may overwrite some bytes from the partial block encoding
193
+ // if their value was 0 (cases 1-2).
194
+ encodingBaseIndex = encodedLength - padding;
195
+ while( padding-- > 0 ) {
196
+ encodingBytes[encodingBaseIndex++] = '=';
197
+ }
198
+ encoding = [[NSString alloc] initWithBytes:encodingBytes length:encodedLength encoding:NSASCIIStringEncoding];
199
+ }
200
+ }
201
+ @catch (NSException *exception) {
202
+ encoding = nil;
203
+ NSLog(@"WARNING: error occured while tring to encode base 32 data: %@", exception);
204
+ }
205
+ @finally {
206
+ if( encodingBytes != NULL ) {
207
+ free( encodingBytes );
208
+ }
209
+ }
210
+ return encoding;
211
+ }
212
+ @end
213
+
214
+ @implementation NSString (Base64Addition)
215
+ -(NSString *)base64String
216
+ {
217
+ NSData *utf8encoding = [self dataUsingEncoding:NSUTF8StringEncoding];
218
+ return [MF_Base64Codec base64StringFromData:utf8encoding];
219
+ }
220
+ -(NSString *)base64UrlEncodedString
221
+ {
222
+ return [MF_Base64Codec base64UrlEncodedStringFromBase64String:[self base64String]];
223
+ }
224
+ +(NSString *)stringFromBase64String:(NSString *)base64String
225
+ {
226
+ NSData *utf8encoding = [MF_Base64Codec dataFromBase64String:base64String];
227
+ return [[NSString alloc] initWithData:utf8encoding encoding:NSUTF8StringEncoding];
228
+ }
229
+ +(NSString *)stringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString
230
+ {
231
+ return [self stringFromBase64String:[MF_Base64Codec base64StringFromBase64UrlEncodedString:base64UrlEncodedString]];
232
+ }
233
+ @end
234
+
235
+ @implementation NSData (Base64Addition)
236
+ +(NSData *)dataWithBase64String:(NSString *)base64String
237
+ {
238
+ return [MF_Base64Codec dataFromBase64String:base64String];
239
+ }
240
+ +(NSData *)dataWithBase64UrlEncodedString:(NSString *)base64UrlEncodedString
241
+ {
242
+ return [self dataWithBase64String:[MF_Base64Codec base64StringFromBase64UrlEncodedString:base64UrlEncodedString]];
243
+ }
244
+ -(NSString *)base64String
245
+ {
246
+ return [MF_Base64Codec base64StringFromData:self];
247
+ }
248
+ -(NSString *)base64UrlEncodedString
249
+ {
250
+ return [MF_Base64Codec base64UrlEncodedStringFromBase64String:[self base64String]];
251
+ }
252
+ @end
@@ -0,0 +1,47 @@
1
+ [![CI Status](https://travis-ci.org/ekscrypto/Base64.svg?branch=master)](https://github.com/ekscrypto/Base64)
2
+
3
+ Base64 Additions for Objective-C on Mac OS X and iOS
4
+ =======
5
+
6
+
7
+ Usage
8
+ ----
9
+ Open the Xcode project file, and drag MF_Base64Additions.m/.h into your project.
10
+
11
+ In files where you want to use Base64 encoding/decoding, simply include the header file and use one of the provided NSData or NSString additions.
12
+
13
+ Example use:
14
+ #import "MF_Base64Additions.h"
15
+
16
+ NSString *helloWorld = @"Hello World";
17
+ NSString *helloInBase64 = [helloWorld base64String];
18
+ NSString *helloDecoded = [NSString stringFromBase64String:helloInBase64];
19
+
20
+
21
+
22
+
23
+ Performance
24
+ ----
25
+ * Encoding: Approximately 4 to 5 times faster than using the equivalent SecTransform.
26
+ * Encoding: 30% faster than https://github.com/l4u/NSData-Base64
27
+ * Decoding: 5% faster than using the equivalent SecTransform.
28
+ * Decoding: 5% faster than https://github.com/l4u/NSData-Base64
29
+
30
+
31
+
32
+ Requirements
33
+ -----
34
+ * Compile with Automatic Reference Counting
35
+ * Compatible with Mac OSX 10.6+ and iOS 4.0+
36
+
37
+
38
+
39
+ Implementation
40
+ ----
41
+ * Implemented as per RFC 4648, see http://www.ietf.org/rfc/rfc4648.txt for more details.
42
+
43
+
44
+
45
+ Licensing
46
+ ----
47
+ * Public Domain