You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Integrate PSPDFKit for React Native on iOS using CocoaPods
2
-
3
-
4
-
1. Create the app with react-native init YourApp.
5
-
2. Step into your newly created app folder: cd YourApp
6
-
3. Install react-native-pspdfkit from GitHub: yarn add github:PSPDFKit/react-native#rad/podspec (#rad/podspec is temporary, as the change is only on that branch)
7
-
4. IMPORTANT: Do not link module react-native-pspdfkit: Do not use react-native link react-native-pspdfkit
8
-
5. Create the folder PSPDFKit and copy PSPDFKit.framework into it.
9
-
6. Open ios/YourApp.xcodeproj in Xcode: open ios/YourApp.xcodeproj
10
-
7. Make sure the deployment target is set to 9.0 or higher:
1
+
## PSPDFKit for React Native
2
+
3
+
### CocoaPods integration
4
+
5
+
#### Requirements
6
+
- Xcode 8.3.3
7
+
- PSPDFKit >=6.8
8
+
- react-native >= 0.46.4
9
+
- CocoaPods >= 1.2.1
10
+
11
+
#### Getting Started
12
+
13
+
Lets create a simple app that integrates `PSPDFKit.framework` using CocoaPods.
14
+
15
+
1. Make sure `react-native-cli` is installed: `yarn global add react-native-cli`
16
+
2. Create the app with `react-native init YourApp`.
17
+
3. Step into your newly created app folder: `cd YourApp`
18
+
4. Install `react-native-pspdfkit` from GitHub: `yarn add github:PSPDFKit/react-native`
19
+
5. IMPORTANT: Do not link module react-native-pspdfkit: Do not use react-native link react-native-pspdfkit
20
+
6. Create the folder `ios/PSPDFKit` and copy `PSPDFKit.framework` into it.
21
+
7. Open ios/YourApp.xcodeproj in Xcode: open ios/YourApp.xcodeproj
22
+
8. Make sure the deployment target is set to 9.0 or higher:
9. Change "View controller-based status bar appearance" to YES in Info.plist:
11
25
deployment-target.png
26
+
10. Close the Xcode project
27
+
11. Go back to the Terminal, `cd ios` then run `pod init`
28
+
12. Replace the content of your newly created `Podfile` with this:
12
29
13
-
1. Change "View controller-based status bar appearance" to YES in Info.plist:
14
-
deployment-target.png
15
-
16
-
1. Change your bundle ID to match the one for which you have a PSPDFKit license
17
-
2. Close the Xcode project
18
-
3. Run react-native run-ios to make sure your app runs before adding PSPDFKit
19
-
4. Go back to the terminal and run pod init
20
-
5. Replace the content of your newly created Podfile with this:
21
-
22
-
30
+
```
23
31
target 'YourApp' do
24
32
# Native Navigation uses Swift, so this line is required!
25
33
use_frameworks!
26
34
27
-
28
35
pod 'react-native-pspdfkit', :path => '../node_modules/react-native-pspdfkit'
29
36
30
-
31
37
# To use CocoaPods with React Native, you need to add this specific Yoga spec as well
32
38
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
33
39
34
-
35
40
# You don't necessarily need all of these subspecs, but this would be a typical setup.
36
41
pod 'React', :path => '../node_modules/react-native', :subspecs => [
37
42
'Core',
@@ -45,38 +50,33 @@ target 'YourApp' do
45
50
# Add any other subspecs you want to use in your project
46
51
]
47
52
48
-
49
53
# Add any other dependencies here, including any 3rd party native libraries that you depend on for
50
54
# React Native.
51
55
end
52
-
53
-
54
-
1. Run pod install
55
-
2. Open the newly created workspace: YourApp.workspace
56
-
3. Copy PSPDFKit into the Pods folder: YourApp/ios/Pods[a]
57
-
4. Drag and drop if from the Finder into the RCTPSPDFKit group:
58
-
drag-and-drop.png
59
-
60
-
1. Add it to the react-native-pspdfkit framework:
61
-
add-to-react-native-pspdfkit.png
62
-
63
-
1. Embed YourApp/ios/PSPDFKit/PSPDFKit.framework (not the copy from YourApp/ios/Pods/PSPDFKit.framework) by drag and dropping it into the "Embedded Binaries" section of the "YourApp" target (Select "Create groups"). This will also add it to the "Linked Frameworks and Libraries" section:
64
-
embedding-pspdfkit.png
65
-
66
-
1. Add a PDF by drag and dropping it into your Xcode project (Select "Create groups" and add to target "YourApp"). This will add the document to the "Copy Bundle Resources" build phase:
67
-
adding-pdf.png
68
-
69
-
1. Replace the default component from index.ios.js with a simple touch area to present the bundled PDF:
70
-
71
-
56
+
```
57
+
58
+
13. Run `pod install`
59
+
14. Open the newly created workspace: `YourApp.workspace`
60
+
15. Copy `PSPDFKit.framework` into the Pods folder: `YourApp/ios/Pods`
61
+
16. Drag and drop if from the Finder into the `RCTPSPDFKit` group:
18. Embed `YourApp/ios/PSPDFKit/PSPDFKit.framework` (not the copy from `YourApp/ios/Pods/PSPDFKit.framework`) by drag and dropping it into the "Embedded Binaries" section of the "YourApp" target (Select "Create groups"). This will also add it to the "Linked Frameworks and Libraries" section:
19. Add a PDF by drag and dropping it into your Xcode project (Select "Create groups" and add to target "YourApp"). This will add the document to the "Copy Bundle Resources" build phase:
68
+

69
+
20. Replace the default component from index.ios.js`` with a simple touch area to present the bundled PDF:
0 commit comments