Skip to content

Commit

Permalink
Merge pull request #575 from kenstir/kenstir/fix-xcode-14.3
Browse files Browse the repository at this point in the history
Fix Xcode 14.3 which supports only iOS 11.0+
  • Loading branch information
benjohnde authored Oct 5, 2023
2 parents e75eeff + dd38f21 commit 7f05df1
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 34 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ZXingObjC currently has feature parity with ZXing version 3.3.3.

## Requirements

ZXingObjC requires Xcode 8.3.3 and above, targeting either iOS 8.0 and above, or Mac OS X 10.8 Mountain Lion and above.
ZXingObjC requires Xcode 8.3.3 and above, targeting either iOS 11.0 and above, or Mac OS X 10.15 Catalina and above.

## Usage

Expand Down Expand Up @@ -95,7 +95,7 @@ github "TheLevelUp/ZXingObjC" ~> 3.6
[CocoaPods](http://cocoapods.org) is a dependency manager for Swift and Objective-C Cocoa projects. After installing CocoaPods add ZXingObjC to your Podfile:

```ruby
platform :ios, '8.0'
platform :ios, '11.0'
pod 'ZXingObjC', '~> 3.6.4'
```

Expand Down
4 changes: 2 additions & 2 deletions ZXingObjC.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.xcconfig = { "OTHER_LDFLAGS" => "-ObjC" }

s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.8'
s.ios.deployment_target = '11.0'
s.osx.deployment_target = '10.15'

s.ios.frameworks = 'AVFoundation', 'CoreGraphics', 'CoreMedia', 'CoreVideo', 'ImageIO', 'QuartzCore'
s.osx.frameworks = 'AVFoundation', 'CoreMedia', 'QuartzCore'
Expand Down
37 changes: 22 additions & 15 deletions ZXingObjC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5500,6 +5500,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 25403CA8166A96F900E13304;
Expand Down Expand Up @@ -6822,8 +6823,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.8;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 10.15;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
SDKROOT = iphoneos;
Expand All @@ -6838,7 +6839,7 @@
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = NO;
DSTROOT = /tmp/ZXingObjC.dst;
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ios-Prefix.pch";
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
Expand Down Expand Up @@ -6886,6 +6887,7 @@
GCC_PREFIX_HEADER = "ZXingObjCTests/Supporting Files/Tests-OSX-Prefix.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
INFOPLIST_FILE = "ZXingObjCTests/Supporting Files/ZXingObjCTests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.15;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
Expand All @@ -6911,6 +6913,7 @@
INFOPLIST_FILE = "mac-Info.plist";
LD_DYLIB_INSTALL_NAME = "@rpath/../Frameworks/$(EXECUTABLE_PATH)";
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.15;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ZXingObjC;
SDKROOT = macosx;
Expand Down Expand Up @@ -6962,8 +6965,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.8;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 10.15;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -7006,8 +7009,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.8;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 10.15;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
SDKROOT = iphoneos;
Expand All @@ -7022,7 +7025,7 @@
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = NO;
DSTROOT = /tmp/ZXingObjC.dst;
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ios-Prefix.pch";
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
Expand All @@ -7041,7 +7044,7 @@
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = NO;
DSTROOT = /tmp/ZXingObjC.dst;
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ios-Prefix.pch";
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
Expand Down Expand Up @@ -7113,6 +7116,7 @@
GCC_PREFIX_HEADER = "ZXingObjCTests/Supporting Files/Tests-OSX-Prefix.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
INFOPLIST_FILE = "ZXingObjCTests/Supporting Files/ZXingObjCTests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.15;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
Expand All @@ -7130,6 +7134,7 @@
GCC_PREFIX_HEADER = "ZXingObjCTests/Supporting Files/Tests-OSX-Prefix.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
INFOPLIST_FILE = "ZXingObjCTests/Supporting Files/ZXingObjCTests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.15;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
Expand All @@ -7154,6 +7159,7 @@
INFOPLIST_FILE = "mac-Info.plist";
LD_DYLIB_INSTALL_NAME = "@rpath/../Frameworks/$(EXECUTABLE_PATH)";
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.15;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ZXingObjC;
SDKROOT = macosx;
Expand All @@ -7179,6 +7185,7 @@
INFOPLIST_FILE = "mac-Info.plist";
LD_DYLIB_INSTALL_NAME = "@rpath/../Frameworks/$(EXECUTABLE_PATH)";
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.15;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ZXingObjC;
SDKROOT = macosx;
Expand All @@ -7202,7 +7209,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ios-Prefix.pch";
Expand All @@ -7217,7 +7224,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
INFOPLIST_FILE = "ios-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.$(PRODUCT_NAME:rfc1034identifier)";
Expand Down Expand Up @@ -7245,7 +7252,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ios-Prefix.pch";
Expand All @@ -7256,7 +7263,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
INFOPLIST_FILE = "ios-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.$(PRODUCT_NAME:rfc1034identifier)";
Expand Down Expand Up @@ -7284,7 +7291,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ios-Prefix.pch";
Expand All @@ -7295,7 +7302,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
INFOPLIST_FILE = "ios-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.$(PRODUCT_NAME:rfc1034identifier)";
Expand Down
19 changes: 14 additions & 5 deletions ZXingObjC/client/ZXCapture.m
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,18 @@ - (int)front {
}

- (BOOL)hasFront {
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
return [devices count] > 1;
AVCaptureDeviceDiscoverySession *captureDeviceDiscoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]
mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionFront];
NSArray *devices = [captureDeviceDiscoverySession devices];
return [devices count] > 0;
}

- (BOOL)hasBack {
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
AVCaptureDeviceDiscoverySession *captureDeviceDiscoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]
mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionBack];
NSArray *devices = [captureDeviceDiscoverySession devices];
return [devices count] > 0;
}

Expand Down Expand Up @@ -547,8 +553,11 @@ - (AVCaptureDevice *)device {

AVCaptureDevice *zxd = nil;

NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];

AVCaptureDeviceDiscoverySession *captureDeviceDiscoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]
mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionUnspecified];
NSArray *devices = [captureDeviceDiscoverySession devices];

if ([devices count] > 0) {
if (self.captureDeviceIndex == -1) {
AVCaptureDevicePosition position = AVCaptureDevicePositionBack;
Expand Down
2 changes: 1 addition & 1 deletion ZXingObjC/client/result/ZXResultParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ - (void)appendKeyValue:(NSString *)keyValue result:(NSMutableDictionary *)result

+ (NSString *)urlDecode:(NSString *)encoded {
NSString *result = [encoded stringByReplacingOccurrencesOfString:@"+" withString:@" "];
result = [result stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
result = [result stringByRemovingPercentEncoding];
return result;
}

Expand Down
6 changes: 3 additions & 3 deletions ZXingObjC/core/ZXErrors.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@

#import "ZXErrors.h"

NSError *ZXChecksumErrorInstance() {
NSError *ZXChecksumErrorInstance(void) {
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"This barcode failed its checksum"};

return [[NSError alloc] initWithDomain:ZXErrorDomain code:ZXChecksumError userInfo:userInfo];
}

NSError *ZXFormatErrorInstance() {
NSError *ZXFormatErrorInstance(void) {
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"This barcode does not confirm to the format's rules"};

return [[NSError alloc] initWithDomain:ZXErrorDomain code:ZXFormatError userInfo:userInfo];
}

NSError *ZXNotFoundErrorInstance() {
NSError *ZXNotFoundErrorInstance(void) {
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"A barcode was not found in this image"};

return [[NSError alloc] initWithDomain:ZXErrorDomain code:ZXNotFoundError userInfo:userInfo];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -428,7 +428,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
OTHER_LDFLAGS = "-ObjC";
SDKROOT = iphoneos;
Expand All @@ -449,7 +449,7 @@
"$(SRCROOT)/../../**",
);
INFOPLIST_FILE = "BarcodeScanner-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LIBRARY_SEARCH_PATHS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -469,7 +469,7 @@
"$(SRCROOT)/../../**",
);
INFOPLIST_FILE = "BarcodeScanner-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LIBRARY_SEARCH_PATHS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.zxing.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = BarcodeScannerSwift/BarcodeScannerSwift.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -441,7 +441,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = BarcodeScannerSwift/BarcodeScannerSwift.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down

0 comments on commit 7f05df1

Please sign in to comment.