Browse Source

Clarify use_framework! workaround usage

Mathieu Acthernoene 5 years ago
parent
commit
f2a45a4120
2 changed files with 38 additions and 43 deletions
  1. 26
    31
      README.md
  2. 12
    12
      example/ios/Podfile

+ 26
- 31
README.md View File

@@ -28,36 +28,6 @@ $ yarn add react-native-permissions
28 28
 By default no permission handler is installed. Update your `Podfile` by choosing the ones you want to check or request, then run `pod install`.
29 29
 
30 30
 ```ruby
31
-# if you have prebuild dynamic cocoapods dependencies and could not migrate
32
-# to use_modular_headers you should use workaround for linking app with dynamic frameworks
33
-# and with static libraries by placing this code at the top of Podfile
34
-# 
35
-# Add this code at the top of Podfile right after platform definition
36
-use_frameworks!
37
-
38
-dynamic_frameworks = ['RxCocoa', 'RxSwift', 'WhatEverSDKName']
39
-
40
-# make all the other dependencies into static libraries by overriding the static_library
41
-pre_install do |installer|
42
-    installer.pod_targets.each do |pod|
43
-        if !dynamic_frameworks.include?(pod.name)
44
-            puts "Overriding the static_library for #{pod.name}"
45
-            def pod.build_type;
46
-              Pod::Target::BuildType.static_library
47
-              # for static framework -
48
-              # Pod::Target::BuildType.static_framework
49
-            end
50
-        end
51
-    end
52
-end
53
-```
54
-
55
-```ruby
56
-# 🚨 If you use use_framework! 🚨
57
-# - Ensure that you have installed at least Cocoapods 1.5.0
58
-# - Replace use_framework! with use_modular_headers!
59
-# (see http://blog.cocoapods.org/CocoaPods-1.5.0 for more details)
60
-
61 31
 target 'YourAwesomeProject' do
62 32
 
63 33
   # …
@@ -84,7 +54,32 @@ target 'YourAwesomeProject' do
84 54
 end
85 55
 ```
86 56
 
87
-_⚠️ If you encounter the error `Invalid RNPermission X. Should be one of: ()`, first check that you link at least one permission handler. If you did, try to cleanup Xcode junk data with `npx react-native-clean-project --remove-iOS-build --remove-iOS-pods`_
57
+#### ⚠️ If you encounter the error `Invalid RNPermission X. Should be one of: ()`
58
+
59
+1. Check that you linked **at least one** permission handler.
60
+2. Clean up Xcode stale data with `npx react-native-clean-project --remove-iOS-build --remove-iOS-pods`
61
+3. If you use `use_frameworks!`, replace it by `use_modular_headers!` - see [this blog post](http://blog.cocoapods.org/CocoaPods-1.5.0) for more details
62
+4. If you use `use_frameworks!` but **can't** replace it with `use_modular_headers!`, check the following workaround:
63
+
64
+```ruby
65
+# Add this code at the top of Podfile right after platform definition.
66
+# It will make all the dynamic frameworks turning into static libraries.
67
+
68
+use_frameworks!
69
+
70
+$dynamic_frameworks = ['RxCocoa', 'RxSwift', 'WhatEverSDKName']
71
+
72
+pre_install do |installer|
73
+  installer.pod_targets.each do |pod|
74
+    if !$dynamic_frameworks.include?(pod.name)
75
+      puts "Overriding the static_framework? method for #{pod.name}"
76
+      def pod.build_type;
77
+        Pod::Target::BuildType.static_library
78
+      end
79
+    end
80
+  end
81
+end
82
+```
88 83
 
89 84
 Then update your `Info.plist` with wanted permissions usage descriptions:
90 85
 

+ 12
- 12
example/ios/Podfile View File

@@ -1,21 +1,21 @@
1 1
 platform :ios, '9.0'
2 2
 
3
-# if you have prebuild dynamic cocoapods dependencies and could not migrate
4
-# to use_modular_headers you should use workaround for linking app with dynamic frameworks
5
-# and with static libraries by uncommenting next code
3
+# If you use `use_frameworks!` but can't replace it with `use_modular_headers!`,
4
+# you can make all the dynamic frameworks turning into static libraries.
6 5
 
7 6
 # use_frameworks!
8
-# dynamic_frameworks = []
7
+# $dynamic_frameworks = []
8
+
9 9
 # pre_install do |installer|
10
-#   # make all the other libraries into static frameworks by overriding the static_library
11
-#     installer.pod_targets.each do |pod|
12
-#         if !dynamic_frameworks.include?(pod.name)
13
-#             puts "Overriding the static_framework? method for #{pod.name}"
14
-#             def pod.build_type;
15
-#               Pod::Target::BuildType.static_library
16
-#             end
17
-#         end
10
+#   #
11
+#   installer.pod_targets.each do |pod|
12
+#     if !$dynamic_frameworks.include?(pod.name)
13
+#       puts "Overriding the static_framework? method for #{pod.name}"
14
+#       def pod.build_type;
15
+#         Pod::Target::BuildType.static_library
16
+#       end
18 17
 #     end
18
+#   end
19 19
 # end
20 20
 
21 21
 require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'