Skip to content
Open
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
2 changes: 2 additions & 0 deletions Example/QRCodeReader.swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@
CE8FFEED1BAB4E8000D43F38 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
Expand All @@ -666,6 +667,7 @@
CE8FFEEE1BAB4E8000D43F38 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
Expand Down
8 changes: 6 additions & 2 deletions Sources/QRCodeReaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ final public class QRCodeReaderView: UIView, QRCodeReaderDisplayable {

overlayView?.setNeedsDisplay()

if let connection = reader?.previewLayer.connection, connection.isVideoOrientationSupported {
let application = UIApplication.shared
if let connection = reader?.previewLayer.connection, connection.isVideoOrientationSupported, let application = QRCodeReaderView.sharedApplication {
let orientation = UIDevice.current.orientation
let supportedInterfaceOrientations = application.supportedInterfaceOrientations(for: application.keyWindow)

Expand All @@ -165,6 +164,11 @@ final public class QRCodeReaderView: UIView, QRCodeReaderDisplayable {

// MARK: - Convenience Methods

private class var sharedApplication: UIApplication? {
let selector = NSSelectorFromString("sharedApplication")
return UIApplication.perform(selector)?.takeRetainedValue() as? UIApplication
}

private func addComponents() {
#if swift(>=4.2)
let notificationName = UIDevice.orientationDidChangeNotification
Expand Down