Bladeren bron

Clarify use_framework! workaround usage

Mathieu Acthernoene 4 jaren geleden
bovenliggende
commit
f2a45a4120
2 gewijzigde bestanden met toevoegingen van 38 en 43 verwijderingen
  1. 26
    31
      README.md
  2. 12
    12
      example/ios/Podfile

+ 26
- 31
README.md Bestand weergeven

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`.
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
 ```ruby
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
 target 'YourAwesomeProject' do
31
 target 'YourAwesomeProject' do
62
 
32
 
63
   # …
33
   # …
84
 end
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
 Then update your `Info.plist` with wanted permissions usage descriptions:
84
 Then update your `Info.plist` with wanted permissions usage descriptions:
90
 
85
 

+ 12
- 12
example/ios/Podfile Bestand weergeven

1
 platform :ios, '9.0'
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
 # use_frameworks!
6
 # use_frameworks!
8
-# dynamic_frameworks = []
7
+# $dynamic_frameworks = []
8
+
9
 # pre_install do |installer|
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
 #     end
17
 #     end
18
+#   end
19
 # end
19
 # end
20
 
20
 
21
 require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
21
 require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'