Skip to content

Commit fb77b20

Browse files
authored
Merge pull request #235 from PSPDFKit/rad/fix-cocoapods-integration
Fix CocoaPods integration
2 parents 4d24321 + fe38898 commit fb77b20

File tree

7 files changed

+41
-36
lines changed

7 files changed

+41
-36
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ The [PSPDFKit SDK](https://pspdfkit.com/) is a framework that allows you to view
2727

2828
#### Requirements
2929

30-
- Xcode 10.2
31-
- PSPDFKit 8.2.3 for iOS or later
32-
- react-native >= 0.57.8
30+
- Xcode 10.2.1
31+
- PSPDFKit 8.4.0 for iOS or later
32+
- react-native >= 0.59.9
3333

3434
#### Getting Started
3535

@@ -79,10 +79,10 @@ import {
7979
View
8080
} from "react-native";
8181

82-
var PSPDFKit = NativeModules.PSPDFKit;
82+
const PSPDFKit = NativeModules.PSPDFKit;
8383
PSPDFKit.setLicenseKey("YOUR_LICENSE_KEY_GOES_HERE");
8484

85-
export default class App extends Component<{}> {
85+
export default class App extends Component<Props> {
8686
_onPressButton() {
8787
PSPDFKit.present("document.pdf", {
8888
pageTransition: "scrollContinuous",

ios/RCTPSPDFKit.xcodeproj/project.pbxproj

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@
195195
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
196196
CLANG_WARN_SUSPICIOUS_MOVES = YES;
197197
DEBUG_INFORMATION_FORMAT = dwarf;
198+
FRAMEWORK_SEARCH_PATHS = (
199+
"$(PROJECT_DIR)/../PSPDFKit",
200+
"$(PROJECT_DIR)/../../../ios/PSPDFKit",
201+
"$(PROJECT_DIR)/../../../ios/Pods/PSPDFKit",
202+
);
198203
OTHER_LDFLAGS = "-ObjC";
199204
PRODUCT_NAME = "$(TARGET_NAME)";
200205
SKIP_INSTALL = YES;
@@ -209,6 +214,11 @@
209214
CLANG_WARN_SUSPICIOUS_MOVES = YES;
210215
COPY_PHASE_STRIP = NO;
211216
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
217+
FRAMEWORK_SEARCH_PATHS = (
218+
"$(PROJECT_DIR)/../PSPDFKit",
219+
"$(PROJECT_DIR)/../../../ios/PSPDFKit",
220+
"$(PROJECT_DIR)/../../../ios/Pods/PSPDFKit",
221+
);
212222
OTHER_LDFLAGS = "-ObjC";
213223
PRODUCT_NAME = "$(TARGET_NAME)";
214224
SKIP_INSTALL = YES;
@@ -272,7 +282,7 @@
272282
"$(SRCROOT)/../../react-native/React/**",
273283
"$(SRCROOT)/../samples/Catalog/node_modules/react-native/React/**",
274284
);
275-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
285+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
276286
MTL_ENABLE_DEBUG_INFO = YES;
277287
ONLY_ACTIVE_ARCH = YES;
278288
SDKROOT = iphoneos;
@@ -329,7 +339,7 @@
329339
"$(SRCROOT)/../../react-native/React/**",
330340
"$(SRCROOT)/../samples/Catalog/node_modules/react-native/React/**",
331341
);
332-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
342+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
333343
MTL_ENABLE_DEBUG_INFO = NO;
334344
SDKROOT = iphoneos;
335345
VALIDATE_PRODUCT = YES;

ios/cocoapods.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
### CocoaPods integration
44

55
#### Requirements
6-
- Xcode 10.1
7-
- PSPDFKit 8.1.3 for iOS or later
8-
- react-native >= 0.57.8
9-
- CocoaPods >= 1.5.3
6+
- Xcode 10.2.1
7+
- PSPDFKit 8.4.0 for iOS or later
8+
- react-native >= 0.59.9
9+
- CocoaPods >= 1.7.2
1010

1111
#### Getting Started
1212

@@ -16,22 +16,24 @@ Lets create a simple app that integrates PSPDFKit using CocoaPods.
1616
2. Create the app with `react-native init YourApp`.
1717
3. Step into your newly created app folder: `cd YourApp`
1818
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` and `PSPDFKitUI.framework` into it.
19+
5. Install all the dependencies for the project: `yarn install`. (Because of a [bug](https://github.com/yarnpkg/yarn/issues/2165) you may need to clean `yarn`'s cache with `yarn cache clean` before.)
20+
6. Link module `react-native-pspdfkit`: `react-native link react-native-pspdfkit`.
2121
7. Open ios/YourApp.xcodeproj in Xcode: open ios/YourApp.xcodeproj
22-
8. Make sure the deployment target is set to 10.0 or higher:
22+
8. Make sure the deployment target is set to 11.0 or higher:
2323
![Deployment Target](../screenshots/deployment-target.png)
24-
9. Change "View controller-based status bar appearance" to YES in Info.plist:
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:
24+
9. Change "View controller-based status bar appearance" to `YES` in `Info.plist`:
25+
![View Controller-Based Status Bar Appearance](../screenshots/view-controller-based-status-bar-appearance.png)
26+
10. Link with the `libRCTPSPDFKit.a` static library (if `libRCTPSPDFKit.a` is already there but greyed out, delete it and link it again):
27+
![Linking Static Library](../screenshots/linking-static-library.png)
28+
11. Close the Xcode project
29+
12. Go back to the Terminal, `cd ios` then run `pod init`
30+
13. Replace the content of your newly created `Podfile` with this:
2931

3032
```podfile
3133
target 'YourApp' do
3234
use_frameworks!
3335
34-
pod 'react-native-pspdfkit', :path => '../node_modules/react-native-pspdfkit'
36+
pod 'PSPDFKit', podspec: 'https://customers.pspdfkit.com/cocoapods/YOUR_COCOAPODS_KEY_GOES_HERE/pspdfkit/latest.podspec'
3537
3638
# Your 'node_modules' directory is probably in the root of your project,
3739
# but if not, adjust the `:path` accordingly
@@ -55,18 +57,11 @@ target 'YourApp' do
5557
end
5658
```
5759

58-
13. Run `pod install`
59-
14. Open the newly created workspace: `YourApp.workspace`
60-
15. Copy `PSPDFKit.framework` and `PSPDFKitUI.framework` into the Pods folder: `YourApp/ios/Pods`
61-
16. Drag and drop it from the Finder into the `RCTPSPDFKit` group:
62-
![Deployment Target](../screenshots/embedding-pspdfkit-pods.png)
63-
17. Add it to the `react-native-pspdfkit` framework:
64-
![Deployment Target](../screenshots/adding-to-react-native-pspdfkit.png)
65-
18. Embed `YourApp/ios/PSPDFKit/PSPDFKit.framework` and `YourApp/ios/PSPDFKit/PSPDFKitUI.framework` (not the copies from `YourApp/ios/Pods/`) 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:
66-
![Embedding PSPDFKit](../screenshots/embedding-pspdfkit.png)
67-
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:
60+
14. Run `pod install`
61+
15. Open the newly created workspace: `YourApp.workspace`
62+
16. 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:
6863
![Adding PDF](../screenshots/adding-pdf.png)
69-
20. Replace the default component from `index.ios.js` with a simple touch area to present the bundled PDF:
64+
17. Replace the default component from `index.ios.js` with a simple touch area to present the bundled PDF:
7065

7166
```javascript
7267
import React, { Component } from 'react';
@@ -79,12 +74,12 @@ import {
7974
View
8075
} from 'react-native';
8176

82-
var PSPDFKit = NativeModules.PSPDFKit;
77+
const PSPDFKit = NativeModules.PSPDFKit;
8378

8479
PSPDFKit.setLicenseKey('INSERT_YOUR_LICENSE_KEY_HERE');
8580

8681
// Change 'YourApp' to your app's name.
87-
class YourApp extends Component {
82+
export default class YourApp extends Component<Props> {
8883
_onPressButton() {
8984
PSPDFKit.present('document.pdf', {})
9085
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-pspdfkit",
3-
"version": "1.24.1",
3+
"version": "1.24.2",
44
"description": "A React Native module for the PSPDFKit library.",
55
"keywords": [
66
"react native",

samples/Catalog/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Catalog",
3-
"version": "1.24.1",
3+
"version": "1.24.2",
44
"private": true,
55
"scripts": {
66
"start": "node node_modules/react-native/local-cli/cli.js start"
-61.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)