Skip to content

Commit

Permalink
Merge pull request #73 from PSPDFKit/rad/update-for-7.6-ios
Browse files Browse the repository at this point in the history
Update for PSPDFKit 7.6 for iOS
  • Loading branch information
radazzouz authored May 31, 2018
2 parents c60c144 + 971627a commit 60bdcec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ The [PSPDFKit SDK](https://pspdfkit.com/) is a framework that allows you to view

#### Requirements

- Xcode 9.3
- PSPDFKit 7 for iOS
- react-native >= 0.48.4
- Xcode 9.4
- PSPDFKit 7.6 for iOS or later
- react-native >= 0.55.4

#### Getting Started

Expand All @@ -33,28 +33,29 @@ Let's create a simple app that integrates PSPDFKit and uses the `react-native-ps
2. Create the app with `react-native init YourApp`.
3. Step into your newly created app folder: `cd YourApp`
4. Install `react-native-pspdfkit` from GitHub: `yarn add github:PSPDFKit/react-native`
5. Link module `react-native-pspdfkit`: `react-native link react-native-pspdfkit`
6. Create the folder `ios/PSPDFKit` and copy `PSPDFKit.framework` and `PSPDFKitUI.framework` into it.
7. Open `ios/YourApp.xcodeproj` in Xcode: `open ios/YourApp.xcodeproj`
8. Make sure the deployment target is set to 9.0 or higher:
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.)
6. Link module `react-native-pspdfkit`: `react-native link react-native-pspdfkit`.
7. Create the folder `ios/PSPDFKit` and copy `PSPDFKit.framework` and `PSPDFKitUI.framework` into it.
8. Open `ios/YourApp.xcodeproj` in Xcode: `open ios/YourApp.xcodeproj`
9. Make sure the deployment target is set to 10.0 or higher:
![Deployment Target](screenshots/deployment-target.png)
9. Change "View controller-based status bar appearance" to `YES` in `Info.plist`:
10. Change "View controller-based status bar appearance" to `YES` in `Info.plist`:
![View Controller-Based Status Bar Appearance](screenshots/view-controller-based-status-bar-appearance.png)
10. Link with the `libRCTPSPDFKit.a` static library (if `libRCTPSPDFKit.a` is already there but greyed out, delete it and link it again):
11. Link with the `libRCTPSPDFKit.a` static library (if `libRCTPSPDFKit.a` is already there but greyed out, delete it and link it again):
![Linking Static Library](screenshots/linking-static-library.png)
11. Embed `PSPDFKit.framework` and `PSPDFKitUI.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 Framworks and Libraries" section:
12. Embed `PSPDFKit.framework` and `PSPDFKitUI.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 Framworks and Libraries" section:
![Embedding PSPDFKit](screenshots/embedding-pspdfkit.png)
12. Add a new `Run Script Phase` in your target’s `Build Phases`.
13. Add a new `Run Script Phase` in your target’s `Build Phases`.
**IMPORTANT:** Make sure this `Run Script Phase` is below the `Embed Frameworks` build phase.
You can drag and drop build phases to rearrange them.
Paste the following line in the script text field of `Run Script Phase`:
```sh
bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/PSPDFKit.framework/strip-framework.sh"
```
![Run Script Phase](screenshots/run-script-phase.png)
13. 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:
14. 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:
![Adding PDF](screenshots/adding-pdf.png)
14. Replace the default component from `App.js` with a simple touch area to present the bundled PDF. (Note that you can also use a [Native UI Component](#native-ui-component) to show a PDF.)
15. Replace the default component from `App.js` with a simple touch area to present the bundled PDF. (Note that you can also use a [Native UI Component](#native-ui-component) to show a PDF.)

```javascript
import React, { Component } from 'react';
Expand Down
Binary file modified screenshots/deployment-target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 60bdcec

Please sign in to comment.