Skip to content

Commit f2a45a4

Browse files
committed
Clarify use_framework! workaround usage
1 parent 07abf12 commit f2a45a4

File tree

2 files changed

+38
-43
lines changed

2 files changed

+38
-43
lines changed

README.md

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,6 @@ $ yarn add react-native-permissions
2828
By default no permission handler is installed. Update your `Podfile` by choosing the ones you want to check or request, then run `pod install`.
2929

3030
```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-
6131
target 'YourAwesomeProject' do
6232

6333
#
@@ -84,7 +54,32 @@ target 'YourAwesomeProject' do
8454
end
8555
```
8656

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+
```
8883

8984
Then update your `Info.plist` with wanted permissions usage descriptions:
9085

example/ios/Podfile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
platform :ios, '9.0'
22

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.
65

76
# use_frameworks!
8-
# dynamic_frameworks = []
7+
# $dynamic_frameworks = []
8+
99
# 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
1817
# end
18+
# end
1919
# end
2020

2121
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

0 commit comments

Comments
 (0)