diff --git a/README.md b/README.md index eaa7cf49..bb029d30 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,9 @@ The [PSPDFKit SDK](https://pspdfkit.com/) is a framework that allows you to view #### Requirements -- Xcode 10.2 -- PSPDFKit 8.2.3 for iOS or later -- react-native >= 0.57.8 +- Xcode 10.2.1 +- PSPDFKit 8.4.0 for iOS or later +- react-native >= 0.59.9 #### Getting Started @@ -79,10 +79,10 @@ import { View } from "react-native"; -var PSPDFKit = NativeModules.PSPDFKit; +const PSPDFKit = NativeModules.PSPDFKit; PSPDFKit.setLicenseKey("YOUR_LICENSE_KEY_GOES_HERE"); -export default class App extends Component<{}> { +export default class App extends Component { _onPressButton() { PSPDFKit.present("document.pdf", { pageTransition: "scrollContinuous", diff --git a/ios/RCTPSPDFKit.xcodeproj/project.pbxproj b/ios/RCTPSPDFKit.xcodeproj/project.pbxproj index 9f37ddbe..1ccc80db 100644 --- a/ios/RCTPSPDFKit.xcodeproj/project.pbxproj +++ b/ios/RCTPSPDFKit.xcodeproj/project.pbxproj @@ -195,6 +195,11 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; DEBUG_INFORMATION_FORMAT = dwarf; + FRAMEWORK_SEARCH_PATHS = ( + "$(PROJECT_DIR)/../PSPDFKit", + "$(PROJECT_DIR)/../../../ios/PSPDFKit", + "$(PROJECT_DIR)/../../../ios/Pods/PSPDFKit", + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -209,6 +214,11 @@ CLANG_WARN_SUSPICIOUS_MOVES = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(PROJECT_DIR)/../PSPDFKit", + "$(PROJECT_DIR)/../../../ios/PSPDFKit", + "$(PROJECT_DIR)/../../../ios/Pods/PSPDFKit", + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -272,7 +282,7 @@ "$(SRCROOT)/../../react-native/React/**", "$(SRCROOT)/../samples/Catalog/node_modules/react-native/React/**", ); - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -329,7 +339,7 @@ "$(SRCROOT)/../../react-native/React/**", "$(SRCROOT)/../samples/Catalog/node_modules/react-native/React/**", ); - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/ios/cocoapods.md b/ios/cocoapods.md index f47ad5f2..96ad74ff 100644 --- a/ios/cocoapods.md +++ b/ios/cocoapods.md @@ -3,10 +3,10 @@ ### CocoaPods integration #### Requirements -- Xcode 10.1 -- PSPDFKit 8.1.3 for iOS or later -- react-native >= 0.57.8 -- CocoaPods >= 1.5.3 +- Xcode 10.2.1 +- PSPDFKit 8.4.0 for iOS or later +- react-native >= 0.59.9 +- CocoaPods >= 1.7.2 #### Getting Started @@ -16,22 +16,24 @@ Lets create a simple app that integrates PSPDFKit using CocoaPods. 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. IMPORTANT: Do not link module react-native-pspdfkit: Do not use react-native link react-native-pspdfkit -6. Create the folder `ios/PSPDFKit` and copy `PSPDFKit.framework` and `PSPDFKitUI.framework` into it. +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. Open ios/YourApp.xcodeproj in Xcode: open ios/YourApp.xcodeproj -8. Make sure the deployment target is set to 10.0 or higher: +8. Make sure the deployment target is set to 11.0 or higher: ![Deployment Target](../screenshots/deployment-target.png) -9. Change "View controller-based status bar appearance" to YES in Info.plist: - deployment-target.png -10. Close the Xcode project -11. Go back to the Terminal, `cd ios` then run `pod init` -12. Replace the content of your newly created `Podfile` with this: +9. 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): + ![Linking Static Library](../screenshots/linking-static-library.png) +11. Close the Xcode project +12. Go back to the Terminal, `cd ios` then run `pod init` +13. Replace the content of your newly created `Podfile` with this: ```podfile target 'YourApp' do use_frameworks! - pod 'react-native-pspdfkit', :path => '../node_modules/react-native-pspdfkit' + pod 'PSPDFKit', podspec: 'https://customers.pspdfkit.com/cocoapods/YOUR_COCOAPODS_KEY_GOES_HERE/pspdfkit/latest.podspec' # Your 'node_modules' directory is probably in the root of your project, # but if not, adjust the `:path` accordingly @@ -55,18 +57,11 @@ target 'YourApp' do end ``` -13. Run `pod install` -14. Open the newly created workspace: `YourApp.workspace` -15. Copy `PSPDFKit.framework` and `PSPDFKitUI.framework` into the Pods folder: `YourApp/ios/Pods` -16. Drag and drop it from the Finder into the `RCTPSPDFKit` group: -![Deployment Target](../screenshots/embedding-pspdfkit-pods.png) -17. Add it to the `react-native-pspdfkit` framework: -![Deployment Target](../screenshots/adding-to-react-native-pspdfkit.png) -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: -![Embedding PSPDFKit](../screenshots/embedding-pspdfkit.png) -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: +14. Run `pod install` +15. Open the newly created workspace: `YourApp.workspace` +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: ![Adding PDF](../screenshots/adding-pdf.png) -20. Replace the default component from `index.ios.js` with a simple touch area to present the bundled PDF: +17. Replace the default component from `index.ios.js` with a simple touch area to present the bundled PDF: ```javascript import React, { Component } from 'react'; @@ -79,12 +74,12 @@ import { View } from 'react-native'; -var PSPDFKit = NativeModules.PSPDFKit; +const PSPDFKit = NativeModules.PSPDFKit; PSPDFKit.setLicenseKey('INSERT_YOUR_LICENSE_KEY_HERE'); // Change 'YourApp' to your app's name. -class YourApp extends Component { +export default class YourApp extends Component { _onPressButton() { PSPDFKit.present('document.pdf', {}) } diff --git a/package-lock.json b/package-lock.json index e1c1f613..fcbad3d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-pspdfkit", - "version": "1.24.1", + "version": "1.24.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5fad1668..c298e054 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-pspdfkit", - "version": "1.24.1", + "version": "1.24.2", "description": "A React Native module for the PSPDFKit library.", "keywords": [ "react native", diff --git a/samples/Catalog/package.json b/samples/Catalog/package.json index 7e150e40..358ae61f 100644 --- a/samples/Catalog/package.json +++ b/samples/Catalog/package.json @@ -1,6 +1,6 @@ { "name": "Catalog", - "version": "1.24.1", + "version": "1.24.2", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start" diff --git a/screenshots/embedding-pspdfkit-pods.png b/screenshots/embedding-pspdfkit-pods.png deleted file mode 100644 index 1e6c8114..00000000 Binary files a/screenshots/embedding-pspdfkit-pods.png and /dev/null differ