From 62435157a64b384ba7a4d1da103fd6f771ae4b5e Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Wed, 7 Jun 2023 16:18:20 -0700 Subject: [PATCH 1/3] fix: Error finding WKWebViewConfiguration class --- CordovaLib/Classes/Public/CDVViewController.m | 1 + 1 file changed, 1 insertion(+) diff --git a/CordovaLib/Classes/Public/CDVViewController.m b/CordovaLib/Classes/Public/CDVViewController.m index 3b95fc98c..9302dc2b7 100644 --- a/CordovaLib/Classes/Public/CDVViewController.m +++ b/CordovaLib/Classes/Public/CDVViewController.m @@ -19,6 +19,7 @@ Licensed to the Apache Software Foundation (ASF) under one @import AVFoundation; @import Foundation; +@import WebKit; #import #import From 1add8549cd943e4db6227f1402d316b91ce4e84f Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Wed, 7 Jun 2023 16:20:41 -0700 Subject: [PATCH 2/3] fix: Resolve Xcode test warnings --- tests/CordovaLibTests/CDVPluginInitTests.m | 8 ++- .../CordovaLibTests.xcodeproj/project.pbxproj | 23 ++++++--- .../xcschemes/CordovaLibApp.xcscheme | 2 +- .../xcschemes/CordovaLibTests.xcscheme | 2 +- .../SampleApp.xcodeproj/project.pbxproj | 51 +++++++++++-------- 5 files changed, 55 insertions(+), 31 deletions(-) diff --git a/tests/CordovaLibTests/CDVPluginInitTests.m b/tests/CordovaLibTests/CDVPluginInitTests.m index 4e765004e..c5f8779ac 100644 --- a/tests/CordovaLibTests/CDVPluginInitTests.m +++ b/tests/CordovaLibTests/CDVPluginInitTests.m @@ -63,6 +63,12 @@ - (void)testSwiftVariablesInitialized { CDVPlugin* swiftPlugin = [self pluginInstance:@"SwiftInit"]; - XCTAssertTrue([@"Successfully initialized" isEqualToString:[swiftPlugin performSelector:sel_getUid("getInitString")]]); + XCTAssertTrue([@"Successfully initialized" isEqualToString:[swiftPlugin performSelector:@selector(getInitString)]]); +} + +// Unused, just to avoid a warning about the selector use above +- (NSString*)getInitString +{ + return nil; } @end diff --git a/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj b/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj index ca669b415..5e014bdc5 100644 --- a/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj +++ b/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj @@ -400,13 +400,15 @@ ); inputPaths = ( "", + "$(SRCROOT)/../../templates/project/www/cordova.js", ); name = "Copy cordova.js into www directory"; outputPaths = ( + $BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www/cordova.js, ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cp ../../templates/project/www/cordova.js \"$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www/cordova.js\""; + shellScript = "cp ../../templates/project/www/cordova.js \"$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www/cordova.js\"\n"; showEnvVarsInLog = 0; }; C0FA7CA61E4BB6420077B045 /* Copy cordova.js into www directory */ = { @@ -416,13 +418,15 @@ ); inputPaths = ( "", + "$(SRCROOT)/../../templates/project/www/cordova.js", ); name = "Copy cordova.js into www directory"; outputPaths = ( + $BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www/cordova.js, ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cp ../../templates/project/www/cordova.js \"$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www/cordova.js\""; + shellScript = "cp ../../templates/project/www/cordova.js \"$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www/cordova.js\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -521,6 +525,7 @@ buildSettings = { CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -533,6 +538,7 @@ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -540,12 +546,11 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = c99; GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_THUMB_SUPPORT = NO; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_VERSION = ""; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -554,6 +559,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + MERGED_BINARY_TYPE = automatic; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DDEBUG"; OTHER_LDFLAGS = ( @@ -577,6 +583,7 @@ buildSettings = { CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -589,17 +596,18 @@ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = c99; GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_THUMB_SUPPORT = NO; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_VERSION = ""; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -608,6 +616,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + MERGED_BINARY_TYPE = automatic; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "-all_load", diff --git a/tests/cordova-ios.xcworkspace/xcshareddata/xcschemes/CordovaLibApp.xcscheme b/tests/cordova-ios.xcworkspace/xcshareddata/xcschemes/CordovaLibApp.xcscheme index 7d6f65f2f..75fb1233a 100644 --- a/tests/cordova-ios.xcworkspace/xcshareddata/xcschemes/CordovaLibApp.xcscheme +++ b/tests/cordova-ios.xcworkspace/xcshareddata/xcschemes/CordovaLibApp.xcscheme @@ -3,7 +3,7 @@ LastUpgradeVersion = "1130" version = "1.7"> Date: Thu, 8 Jun 2023 23:24:20 -0700 Subject: [PATCH 3/3] fix: Don't enable script sandboxing in projects by default This seems to cause too many issues with various 3rd party plugins and pods, so just keep the existing behaviour for generated project files. --- templates/project/__PROJECT_NAME__.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/project/__PROJECT_NAME__.xcodeproj/project.pbxproj b/templates/project/__PROJECT_NAME__.xcodeproj/project.pbxproj index 3ce8caf94..d01241ee7 100755 --- a/templates/project/__PROJECT_NAME__.xcodeproj/project.pbxproj +++ b/templates/project/__PROJECT_NAME__.xcodeproj/project.pbxproj @@ -384,7 +384,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = c99; GCC_NO_COMMON_BLOCKS = YES; GCC_THUMB_SUPPORT = NO; @@ -429,7 +429,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = c99; GCC_NO_COMMON_BLOCKS = YES; GCC_THUMB_SUPPORT = NO;