Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for PSPDFKit 9 for iOS #42

Merged
merged 4 commits into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,5 @@ unlinked_spec.ds
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
/example/ios/Flutter/flutter_export_environment.sh
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,23 +233,26 @@ adb push /path/to/your/document.pdf /sdcard/document.pdf

![iOS View controller-based status bar appearance](screenshots/ios-info-plist-statusbarappearance.png)

8. Run `flutter packages get` to install the packages.
9. Open the `Podfile`: `open ios/Podfile` and edit it as follows:
8. If your application is targeting iOS versions **prior to iOS 12.2** and your application **does not already contain any Swift code**, then you need to make sure Xcode bundles Swift standard libraries with your application distribution. To to so, open your target Build Settings and enable `Always Embed Swift Standard Libraries`:

![Always Embed Swift Standard Libraries](screenshots/ios-always-embed-swift-standard-libraries.png)

9. Run `flutter packages get` to install the packages.
10. Open the `Podfile`: `open ios/Podfile` and edit it as follows:

```diff
# Uncomment this line to define a global platform for your project
- # platform :ios, '9.0'
+ platform :ios, '11.0'
+ use_frameworks!
...
target 'Runner' do

use_frameworks!
+ pod 'PSPDFKit', podspec:'https://customers.pspdfkit.com/cocoapods/YOUR_COCOAPODS_KEY_GOES_HERE/pspdfkit/latest.podspec'
...
end
```

9. Open `lib/main.dart` and replace the whole content with a simple example that will load a PDF document from local device filesystem:
11. Open `lib/main.dart` and replace the whole content with a simple example that will load a PDF document from local device filesystem:

```dart
import 'dart:io';
Expand Down Expand Up @@ -353,9 +356,9 @@ class _MyAppState extends State<MyApp> {
}
```

10. In `lib/main.dart` replace `YOUR_LICENSE_KEY_GOES_HERE` with your PSPDFKit license key.
11. Run `flutter emulators --launch apple_ios_simulator` to launch the iOS Simulator.
12. Run `flutter run`.
12. In `lib/main.dart` replace `YOUR_LICENSE_KEY_GOES_HERE` with your PSPDFKit license key.
13. Run `flutter emulators --launch apple_ios_simulator` to launch the iOS Simulator.
14. Run `flutter run`.

# Example

Expand Down
4 changes: 2 additions & 2 deletions ios/Classes/PspdfkitPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {

- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([@"frameworkVersion" isEqualToString:call.method]) {
result([@"iOS " stringByAppendingString:PSPDFKit.versionNumber]);
result([@"iOS " stringByAppendingString:PSPDFKitGlobal.versionNumber]);
} else if ([@"setLicenseKey" isEqualToString:call.method]) {
NSString *licenseKey = call.arguments[@"licenseKey"];
[PSPDFKit setLicenseKey:licenseKey];
[PSPDFKitGlobal setLicenseKey:licenseKey];
} else if ([@"present" isEqualToString:call.method]) {
NSString *documentPath = call.arguments[@"document"];
NSAssert(documentPath != nil, @"Document path may not be nil.");
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.