Closed iosdeveloper closed 7 years ago
Hi @iosdeveloper,
Here’s a few things to try.
First, if you’re using CocoaPods, please be sure to include the ScreenshotDetector
subspec. Your Podfile should include both of these lines:
pod 'PinpointKit', '~> 1.0'
pod 'PinpointKit/ScreenshotDetector', '~> 1.0'
Next, make sure you’re showing your instance of PinpointKit
in the delegate callback of your instance of ScreenshotDetector
. I tested the following in a sample single-view application to confirm it worked:
//
// ViewController.swift
// PPK
//
// Created by Michael Liberatore on 2/8/17.
// Copyright © 2017 Lickability. All rights reserved.
//
import UIKit
import PinpointKit
class ViewController: UIViewController {
private var screenshotDetector: ScreenshotDetector?
fileprivate let pinpointKit = PinpointKit(feedbackRecipients: ["feedback@example.com"])
override func viewDidLoad() {
super.viewDidLoad()
screenshotDetector = ScreenshotDetector(delegate: self)
}
}
extension ViewController: ScreenshotDetectorDelegate {
func screenshotDetector(_ screenshotDetector: ScreenshotDetector, didFailWith error: ScreenshotDetector.Error) {
print(error)
}
func screenshotDetector(_ screenshotDetector: ScreenshotDetector, didDetect screenshot: UIImage) {
pinpointKit.show(from: self, screenshot: screenshot)
}
}
Please let me know if that helps!
@mliberatore I didn't know (and the README didn't mention it) that this required additional code. Thanks again!
If I take a screenshot it always takes the last screenshot before it.
Also isn't it supposed to prompt for access to the photos library only when actually taking a screenshot, not at initialization?
If I take a screenshot it always takes the last screenshot before it. Also isn't it supposed to prompt for access to the photos library only when actually taking a screenshot, not at initialization?
Thanks, @iosdeveloper. I‘ve opened #214 to address these problems.
I have
NSPhotoLibraryUsageDescription
in my Info.plist. What am I missing?