From d664d2d1834a612b3e92f25b5914d3c1551c741b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Fri, 25 Sep 2015 15:31:29 +0200 Subject: [PATCH 01/16] Make sure we don't add images to final report twice This is to prevent issues with PLCR under iOS 9, see here: https://groups.google.com/forum/#!msg/plcrashreporter/i6rYc2f4yBo/G8uBTEnMAgAJ --- Classes/BITCrashReportTextFormatter.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Classes/BITCrashReportTextFormatter.m b/Classes/BITCrashReportTextFormatter.m index 895f1c012c..aca1c8d6b4 100644 --- a/Classes/BITCrashReportTextFormatter.m +++ b/Classes/BITCrashReportTextFormatter.m @@ -539,7 +539,15 @@ static const char *findSEL (const char *imageName, NSString *imageUUID, uint64_t /* Images. The iPhone crash report format sorts these in ascending order, by the base address */ [text appendString: @"Binary Images:\n"]; + NSMutableArray *addedImagesBaseAddresses = @[].mutableCopy; for (BITPLCrashReportBinaryImageInfo *imageInfo in [report.images sortedArrayUsingFunction: bit_binaryImageSort context: nil]) { + // Make sure we don't add duplicates + if ([addedImagesBaseAddresses containsObject:@(imageInfo.imageBaseAddress)]) { + continue; + } else { + [addedImagesBaseAddresses addObject:@(imageInfo.imageBaseAddress)]; + } + NSString *uuid; /* Fetch the UUID if it exists */ if (imageInfo.hasImageUUID) From 02f2f2f13582dbf8997b5823e9faf1bf86ae7fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Fri, 25 Sep 2015 15:45:06 +0200 Subject: [PATCH 02/16] Fix alert not being shown in CrashOnly build In previous versions, the CrashOnly build could not display the alert to ask the user for permission to send the crash report because the necessary method implementations were missing. --- Classes/BITHockeyBaseManager.m | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Classes/BITHockeyBaseManager.m b/Classes/BITHockeyBaseManager.m index 310107363a..ecac046109 100644 --- a/Classes/BITHockeyBaseManager.m +++ b/Classes/BITHockeyBaseManager.m @@ -202,9 +202,6 @@ } - (UIViewController *)visibleWindowRootViewController { - // if we compile Crash only, then BITHockeyBaseViewController is not included - // in the headers and will cause a warning with the modulemap file -#if HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK UIViewController *parentViewController = nil; if ([[BITHockeyManager sharedHockeyManager].delegate respondsToSelector:@selector(viewControllerForHockeyManager:componentManager:)]) { @@ -234,19 +231,12 @@ } return parentViewController; -#else - return nil; -#endif } - (void)showAlertController:(UIViewController *)alertController { // always execute this on the main thread dispatch_async(dispatch_get_main_queue(), ^{ - - // if we compile Crash only, then BITHockeyBaseViewController is not included - // in the headers and will cause a warning with the modulemap file -#if HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK UIViewController *parentViewController = [self visibleWindowRootViewController]; // as per documentation this only works if called from within viewWillAppear: or viewDidAppear: @@ -260,7 +250,6 @@ if (parentViewController) { [parentViewController presentViewController:alertController animated:YES completion:nil]; } -#endif }); } From 74880df968d817e37102ef43adca5a8bcc7c2615 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Tue, 29 Sep 2015 13:48:45 +0200 Subject: [PATCH 03/16] Add documentation zip to distribution build --- Support/HockeySDK.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Support/HockeySDK.xcodeproj/project.pbxproj b/Support/HockeySDK.xcodeproj/project.pbxproj index faca235c2e..7b06a211be 100644 --- a/Support/HockeySDK.xcodeproj/project.pbxproj +++ b/Support/HockeySDK.xcodeproj/project.pbxproj @@ -1424,7 +1424,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Sets the target folders and the final framework product.\nFMK_NAME=HockeySDK\nFMK_VERSION=A\nFMK_RESOURCE_BUNDLE=HockeySDKResources\nFMK_iOS8_NAME=\"HockeySDK Framework\"\n\n# Documentation\nHOCKEYSDK_DOCSET_VERSION_NAME=\"de.bitstadium.${HOCKEYSDK_DOCSET_NAME}-${VERSION_STRING}\"\n\n# Install dir will be the final output to the framework.\n# The following line create it in the root folder of the current project.\nPRODUCTS_DIR=${SRCROOT}/../Products\nZIP_FOLDER=HockeySDK-iOS\nTEMP_DIR=${PRODUCTS_DIR}/${ZIP_FOLDER}\nINSTALL_DIR=${TEMP_DIR}/${FMK_NAME}.framework\n\n# Working dir will be deleted after the framework creation.\nWRK_DIR=build\nDEVICE_DIR=${WRK_DIR}/Release-iphoneos\nSIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator\nDEVICE_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnly-iphoneos\nSIMULATOR_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnly-iphonesimulator\nDEVICE_EXTENSIONS_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnlyExtensions-iphoneos\nSIMULATOR_EXTENSIONS_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnlyExtensions-iphonesimulator\nDEVICE_WATCH_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnlyWatchOS-iphoneos\nSIMULATOR_WATCH_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnlyWatchOS-iphonesimulator\n\n# Building the full featured SDK\n\n# Building both architectures.\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_NAME}\" -sdk iphoneos\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_NAME}\" -sdk iphonesimulator\n\n# Cleaning the oldest.\nif [ -d \"${TEMP_DIR}\" ]\nthen\nrm -rf \"${TEMP_DIR}\"\nfi\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Modules\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copy the swift import file\ncp -f \"${SRCROOT}/module.modulemap\" \"${INSTALL_DIR}/Modules/\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${SRCROOT}/build/Release-iphoneos/include/HockeySDK/\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${DEVICE_DIR}/${FMK_RESOURCE_BUNDLE}.bundle\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\ncp -f \"${SRCROOT}/${FMK_NAME}.xcconfig\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.\nlipo -create \"${DEVICE_DIR}/lib${FMK_NAME}.a\" \"${SIMULATOR_DIR}/lib${FMK_NAME}.a\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\n# Combine the CrashReporter static library into a new Hockey static library file if they are not already present and copy the public headers too\nif [ -z $(otool -L \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" | grep 'libCrashReporter') ]\nthen\nlibtool -static -o \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${SRCROOT}/../Vendor/CrashReporter.framework/Versions/A/CrashReporter\"\nfi\n\nrm -r \"${WRK_DIR}\"\n\n# build embeddedframework folder and move framework into it\nmkdir \"${INSTALL_DIR}/../${FMK_NAME}.embeddedframework\"\nmv \"${INSTALL_DIR}\" \"${INSTALL_DIR}/../${FMK_NAME}.embeddedframework/${FMK_NAME}.framework\"\n\n# link Resources\nNEW_INSTALL_DIR=${TEMP_DIR}/${FMK_NAME}.embeddedframework\nmkdir \"${NEW_INSTALL_DIR}/Resources\"\nln -s \"../${FMK_NAME}.framework/Resources/${FMK_RESOURCE_BUNDLE}.bundle\" \"${NEW_INSTALL_DIR}/Resources/${FMK_RESOURCE_BUNDLE}.bundle\"\nln -s \"../${FMK_NAME}.framework/Resources/${FMK_NAME}.xcconfig\" \"${NEW_INSTALL_DIR}/Resources/${FMK_NAME}.xcconfig\"\n\n\n# Building the crash only SDK without resources\n\n# Building both architectures.\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"ReleaseCrashOnly\" -target \"${FMK_NAME}\" -sdk iphoneos\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"ReleaseCrashOnly\" -target \"${FMK_NAME}\" -sdk iphonesimulator\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Modules\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copy the swift import file\ncp -f \"${SRCROOT}/module_crashonly.modulemap\" \"${INSTALL_DIR}/Modules/module.modulemap\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}\"/include/HockeySDK/BITCrash*.h \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyAttachment.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyBaseManager.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyManager.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyManagerDelegate.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/include/HockeySDK/HockeySDK.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -f \"${SRCROOT}/${FMK_NAME}.xcconfig\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Copy the patched feature header\ncp -f \"${SRCROOT}/HockeySDKCrashOnlyConfig.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/HockeySDKFeatureConfig.h\"\n\n# Uses the Lipo Tool to merge both binary files (i386/x86_64 + armv7/armv7s/arm64) into one Universal final product.\nlipo -create \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/lib${FMK_NAME}.a\" \"${SRCROOT}/${SIMULATOR_CRASH_ONLY_DIR}/lib${FMK_NAME}.a\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\n# Combine the CrashReporter static library into a new Hockey static library file if they are not already present and copy the public headers too\nif [ -z $(otool -L \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" | grep 'libCrashReporter') ]\nthen\nlibtool -static -o \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${SRCROOT}/../Vendor/CrashReporter.framework/Versions/A/CrashReporter\"\nfi\n\n# Move the crash reporting only framework into a new folder\nmkdir \"${INSTALL_DIR}/../${FMK_NAME}CrashOnly\"\nmv \"${INSTALL_DIR}\" \"${INSTALL_DIR}/../${FMK_NAME}CrashOnly/${FMK_NAME}.framework\"\n\nrm -r \"${WRK_DIR}\"\n\n\n# Building the extensions crash only SDK without resources\n\n# Building both architectures.\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"ReleaseCrashOnlyExtensions\" -target \"${FMK_NAME}\" -sdk iphoneos\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"ReleaseCrashOnlyExtensions\" -target \"${FMK_NAME}\" -sdk iphonesimulator\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Modules\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copy the swift import file\ncp -f \"${SRCROOT}/module_crashonly.modulemap\" \"${INSTALL_DIR}/Modules/module.modulemap\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}\"/include/HockeySDK/BITCrash*.h \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyAttachment.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyBaseManager.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyManager.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyManagerDelegate.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/include/HockeySDK/HockeySDK.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -f \"${SRCROOT}/${FMK_NAME}.xcconfig\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Copy the patched feature header\ncp -f \"${SRCROOT}/HockeySDKCrashOnlyConfig.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/HockeySDKFeatureConfig.h\"\n\n# Uses the Lipo Tool to merge both binary files (i386/x86_64 + armv7/armv7s/arm64) into one Universal final product.\nlipo -create \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/lib${FMK_NAME}.a\" \"${SRCROOT}/${SIMULATOR_EXTENSIONS_CRASH_ONLY_DIR}/lib${FMK_NAME}.a\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\n# Combine the CrashReporter static library into a new Hockey static library file if they are not already present and copy the public headers too\nif [ -z $(otool -L \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" | grep 'libCrashReporter') ]\nthen\nlibtool -static -o \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${SRCROOT}/../Vendor/CrashReporter.framework/Versions/A/CrashReporter\"\nfi\n\n# Move the crash reporting only framework into a new folder\nmkdir \"${INSTALL_DIR}/../${FMK_NAME}CrashOnlyExtension\"\nmv \"${INSTALL_DIR}\" \"${INSTALL_DIR}/../${FMK_NAME}CrashOnlyExtension/${FMK_NAME}.framework\"\n\nrm -r \"${WRK_DIR}\"\n\n\n# Building the iOS 8 and later compatible dynamic framework\n\n# Using the iOS 8 framework binary distribution is not yet recommended, as it contains all architectures (i386, x86_64, armv7, armv7s, arm64)\n# and would be part of the app as is, which currently is about 5.2 MB in size. A proper usage would require the binary to be stripped from non-needed architectures at app build time before\n# This is why the following section is currently commented and not included in any release build\n\n## Building both architectures.\n#xcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_iOS8_NAME}\" -sdk iphonesimulator clean build\n#xcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_iOS8_NAME}\" -sdk iphoneos clean build\n#\n## Copy the framework structure to the destination folder\n#cp -R \"${DEVICE_DIR}/${FMK_NAME}.framework\" \"${TEMP_DIR}/\"\n#\n## Use the Lipo Tool to merge both binary files (i386/x86_64 + armv7/armv7s/arm64) into one Universal final product.\n#lipo -create \"${DEVICE_DIR}/${FMK_NAME}.framework/${FMK_NAME}\" \"${SIMULATOR_DIR}/${FMK_NAME}.framework/${FMK_NAME}\" -output \"${TEMP_DIR}/${FMK_NAME}.framework/${FMK_NAME}\"\n#\n## Move the crash reporting only framework into a new folder\n#mkdir \"${INSTALL_DIR}/../${FMK_NAME}-iOS8\"\n#mv \"${INSTALL_DIR}\" \"${INSTALL_DIR}/../${FMK_NAME}-iOS8/${FMK_NAME}.framework\"\n#\n#rm -r \"${WRK_DIR}\"\n\n\n# copy license, changelog, documentation, integration json\ncp -f \"${SRCROOT}/../Docs/Changelog-template.md\" \"${TEMP_DIR}/CHANGELOG\"\ncp -f \"${SRCROOT}/../Docs/Guide-Installation-Setup-template.md\" \"${TEMP_DIR}/README.md\"\ncp -f \"${SRCROOT}/../LICENSE\" \"${TEMP_DIR}\"\nmkdir \"${TEMP_DIR}/${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\"\ncp -R \"${SRCROOT}/../documentation/docset/Contents\" \"${TEMP_DIR}/${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\"\n\n# build zip\ncd \"${PRODUCTS_DIR}\"\nrm -f \"${FMK_NAME}-iOS-${VERSION_STRING}.zip\"\nzip -yr \"${FMK_NAME}-iOS-${VERSION_STRING}.zip\" \"${ZIP_FOLDER}\" -x \\*/.*\n"; + shellScript = "# Sets the target folders and the final framework product.\nFMK_NAME=HockeySDK\nFMK_VERSION=A\nFMK_RESOURCE_BUNDLE=HockeySDKResources\nFMK_iOS8_NAME=\"HockeySDK Framework\"\n\n# Documentation\nHOCKEYSDK_DOCSET_VERSION_NAME=\"de.bitstadium.${HOCKEYSDK_DOCSET_NAME}-${VERSION_STRING}\"\n\n# Install dir will be the final output to the framework.\n# The following line create it in the root folder of the current project.\nPRODUCTS_DIR=${SRCROOT}/../Products\nZIP_FOLDER=HockeySDK-iOS\nTEMP_DIR=${PRODUCTS_DIR}/${ZIP_FOLDER}\nINSTALL_DIR=${TEMP_DIR}/${FMK_NAME}.framework\n\n# Working dir will be deleted after the framework creation.\nWRK_DIR=build\nDEVICE_DIR=${WRK_DIR}/Release-iphoneos\nSIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator\nDEVICE_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnly-iphoneos\nSIMULATOR_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnly-iphonesimulator\nDEVICE_EXTENSIONS_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnlyExtensions-iphoneos\nSIMULATOR_EXTENSIONS_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnlyExtensions-iphonesimulator\nDEVICE_WATCH_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnlyWatchOS-iphoneos\nSIMULATOR_WATCH_CRASH_ONLY_DIR=${WRK_DIR}/ReleaseCrashOnlyWatchOS-iphonesimulator\n\n# Building the full featured SDK\n\n# Building both architectures.\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_NAME}\" -sdk iphoneos\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_NAME}\" -sdk iphonesimulator\n\n# Cleaning the oldest.\nif [ -d \"${TEMP_DIR}\" ]\nthen\nrm -rf \"${TEMP_DIR}\"\nfi\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Modules\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copy the swift import file\ncp -f \"${SRCROOT}/module.modulemap\" \"${INSTALL_DIR}/Modules/\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${SRCROOT}/build/Release-iphoneos/include/HockeySDK/\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${DEVICE_DIR}/${FMK_RESOURCE_BUNDLE}.bundle\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\ncp -f \"${SRCROOT}/${FMK_NAME}.xcconfig\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.\nlipo -create \"${DEVICE_DIR}/lib${FMK_NAME}.a\" \"${SIMULATOR_DIR}/lib${FMK_NAME}.a\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\n# Combine the CrashReporter static library into a new Hockey static library file if they are not already present and copy the public headers too\nif [ -z $(otool -L \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" | grep 'libCrashReporter') ]\nthen\nlibtool -static -o \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${SRCROOT}/../Vendor/CrashReporter.framework/Versions/A/CrashReporter\"\nfi\n\nrm -r \"${WRK_DIR}\"\n\n# build embeddedframework folder and move framework into it\nmkdir \"${INSTALL_DIR}/../${FMK_NAME}.embeddedframework\"\nmv \"${INSTALL_DIR}\" \"${INSTALL_DIR}/../${FMK_NAME}.embeddedframework/${FMK_NAME}.framework\"\n\n# link Resources\nNEW_INSTALL_DIR=${TEMP_DIR}/${FMK_NAME}.embeddedframework\nmkdir \"${NEW_INSTALL_DIR}/Resources\"\nln -s \"../${FMK_NAME}.framework/Resources/${FMK_RESOURCE_BUNDLE}.bundle\" \"${NEW_INSTALL_DIR}/Resources/${FMK_RESOURCE_BUNDLE}.bundle\"\nln -s \"../${FMK_NAME}.framework/Resources/${FMK_NAME}.xcconfig\" \"${NEW_INSTALL_DIR}/Resources/${FMK_NAME}.xcconfig\"\n\n\n# Building the crash only SDK without resources\n\n# Building both architectures.\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"ReleaseCrashOnly\" -target \"${FMK_NAME}\" -sdk iphoneos\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"ReleaseCrashOnly\" -target \"${FMK_NAME}\" -sdk iphonesimulator\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Modules\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copy the swift import file\ncp -f \"${SRCROOT}/module_crashonly.modulemap\" \"${INSTALL_DIR}/Modules/module.modulemap\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}\"/include/HockeySDK/BITCrash*.h \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyAttachment.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyBaseManager.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyManager.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyManagerDelegate.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/include/HockeySDK/HockeySDK.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -f \"${SRCROOT}/${FMK_NAME}.xcconfig\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Copy the patched feature header\ncp -f \"${SRCROOT}/HockeySDKCrashOnlyConfig.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/HockeySDKFeatureConfig.h\"\n\n# Uses the Lipo Tool to merge both binary files (i386/x86_64 + armv7/armv7s/arm64) into one Universal final product.\nlipo -create \"${SRCROOT}/${DEVICE_CRASH_ONLY_DIR}/lib${FMK_NAME}.a\" \"${SRCROOT}/${SIMULATOR_CRASH_ONLY_DIR}/lib${FMK_NAME}.a\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\n# Combine the CrashReporter static library into a new Hockey static library file if they are not already present and copy the public headers too\nif [ -z $(otool -L \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" | grep 'libCrashReporter') ]\nthen\nlibtool -static -o \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${SRCROOT}/../Vendor/CrashReporter.framework/Versions/A/CrashReporter\"\nfi\n\n# Move the crash reporting only framework into a new folder\nmkdir \"${INSTALL_DIR}/../${FMK_NAME}CrashOnly\"\nmv \"${INSTALL_DIR}\" \"${INSTALL_DIR}/../${FMK_NAME}CrashOnly/${FMK_NAME}.framework\"\n\nrm -r \"${WRK_DIR}\"\n\n\n# Building the extensions crash only SDK without resources\n\n# Building both architectures.\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"ReleaseCrashOnlyExtensions\" -target \"${FMK_NAME}\" -sdk iphoneos\nxcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"ReleaseCrashOnlyExtensions\" -target \"${FMK_NAME}\" -sdk iphonesimulator\n\n# Creates and renews the final product folder.\nmkdir -p \"${INSTALL_DIR}\"\nmkdir -p \"${INSTALL_DIR}/Modules\"\nmkdir -p \"${INSTALL_DIR}/Versions\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources\"\nmkdir -p \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers\"\n\n# Creates the internal links.\n# It MUST uses relative path, otherwise will not work when the folder is copied/moved.\nln -s \"${FMK_VERSION}\" \"${INSTALL_DIR}/Versions/Current\"\nln -s \"Versions/Current/Headers\" \"${INSTALL_DIR}/Headers\"\nln -s \"Versions/Current/Resources\" \"${INSTALL_DIR}/Resources\"\nln -s \"Versions/Current/${FMK_NAME}\" \"${INSTALL_DIR}/${FMK_NAME}\"\n\n# Copy the swift import file\ncp -f \"${SRCROOT}/module_crashonly.modulemap\" \"${INSTALL_DIR}/Modules/module.modulemap\"\n\n# Copies the headers and resources files to the final product folder.\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}\"/include/HockeySDK/BITCrash*.h \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyAttachment.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyBaseManager.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyManager.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/include/HockeySDK/BITHockeyManagerDelegate.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -R \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/include/HockeySDK/HockeySDK.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/\"\ncp -f \"${SRCROOT}/${FMK_NAME}.xcconfig\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Resources/\"\n\n# Copy the patched feature header\ncp -f \"${SRCROOT}/HockeySDKCrashOnlyConfig.h\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/Headers/HockeySDKFeatureConfig.h\"\n\n# Uses the Lipo Tool to merge both binary files (i386/x86_64 + armv7/armv7s/arm64) into one Universal final product.\nlipo -create \"${SRCROOT}/${DEVICE_EXTENSIONS_CRASH_ONLY_DIR}/lib${FMK_NAME}.a\" \"${SRCROOT}/${SIMULATOR_EXTENSIONS_CRASH_ONLY_DIR}/lib${FMK_NAME}.a\" -output \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\"\n\n# Combine the CrashReporter static library into a new Hockey static library file if they are not already present and copy the public headers too\nif [ -z $(otool -L \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" | grep 'libCrashReporter') ]\nthen\nlibtool -static -o \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${INSTALL_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}\" \"${SRCROOT}/../Vendor/CrashReporter.framework/Versions/A/CrashReporter\"\nfi\n\n# Move the crash reporting only framework into a new folder\nmkdir \"${INSTALL_DIR}/../${FMK_NAME}CrashOnlyExtension\"\nmv \"${INSTALL_DIR}\" \"${INSTALL_DIR}/../${FMK_NAME}CrashOnlyExtension/${FMK_NAME}.framework\"\n\nrm -r \"${WRK_DIR}\"\n\n\n# Building the iOS 8 and later compatible dynamic framework\n\n# Using the iOS 8 framework binary distribution is not yet recommended, as it contains all architectures (i386, x86_64, armv7, armv7s, arm64)\n# and would be part of the app as is, which currently is about 5.2 MB in size. A proper usage would require the binary to be stripped from non-needed architectures at app build time before\n# This is why the following section is currently commented and not included in any release build\n\n## Building both architectures.\n#xcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_iOS8_NAME}\" -sdk iphonesimulator clean build\n#xcodebuild -project \"HockeySDK.xcodeproj\" -configuration \"Release\" -target \"${FMK_iOS8_NAME}\" -sdk iphoneos clean build\n#\n## Copy the framework structure to the destination folder\n#cp -R \"${DEVICE_DIR}/${FMK_NAME}.framework\" \"${TEMP_DIR}/\"\n#\n## Use the Lipo Tool to merge both binary files (i386/x86_64 + armv7/armv7s/arm64) into one Universal final product.\n#lipo -create \"${DEVICE_DIR}/${FMK_NAME}.framework/${FMK_NAME}\" \"${SIMULATOR_DIR}/${FMK_NAME}.framework/${FMK_NAME}\" -output \"${TEMP_DIR}/${FMK_NAME}.framework/${FMK_NAME}\"\n#\n## Move the crash reporting only framework into a new folder\n#mkdir \"${INSTALL_DIR}/../${FMK_NAME}-iOS8\"\n#mv \"${INSTALL_DIR}\" \"${INSTALL_DIR}/../${FMK_NAME}-iOS8/${FMK_NAME}.framework\"\n#\n#rm -r \"${WRK_DIR}\"\n\n\n# copy license, changelog, documentation, integration json\ncp -f \"${SRCROOT}/../Docs/Changelog-template.md\" \"${TEMP_DIR}/CHANGELOG\"\ncp -f \"${SRCROOT}/../Docs/Guide-Installation-Setup-template.md\" \"${TEMP_DIR}/README.md\"\ncp -f \"${SRCROOT}/../LICENSE\" \"${TEMP_DIR}\"\nmkdir \"${TEMP_DIR}/${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\"\ncp -R \"${SRCROOT}/../documentation/docset/Contents\" \"${TEMP_DIR}/${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\"\n\n# build zip\ncd \"${PRODUCTS_DIR}\"\nrm -f \"${FMK_NAME}-iOS-${VERSION_STRING}.zip\"\nzip -yr \"${FMK_NAME}-iOS-${VERSION_STRING}.zip\" \"${ZIP_FOLDER}\" -x \\*/.*\n\ncd \"${ZIP_FOLDER}\"\nrm -f \"${FMK_NAME}-iOS-documentation-${VERSION_STRING}.zip\"\nzip -yr \"${FMK_NAME}-iOS-documentation-${VERSION_STRING}.zip\" \"${HOCKEYSDK_DOCSET_VERSION_NAME}.docset\" -x \\*/.*\nmv \"${FMK_NAME}-iOS-documentation-${VERSION_STRING}.zip\" \"../\"\n"; }; 1E8E66B215BC3D8200632A2E /* ShellScript */ = { isa = PBXShellScriptBuildPhase; From 7539ab06ba4f2d52ba4cd6b8673df44668340661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Mon, 28 Sep 2015 15:17:24 +0200 Subject: [PATCH 04/16] Add comments to #endif for clarity --- Classes/BITActivityIndicatorButton.m | 2 +- Classes/BITAppStoreHeader.m | 2 +- Classes/BITArrowImageAnnotation.m | 2 +- Classes/BITAuthenticationViewController.m | 2 +- Classes/BITAuthenticator.m | 2 +- Classes/BITAuthenticator_Private.h | 2 +- Classes/BITBlurImageAnnotation.m | 2 +- Classes/BITCrashCXXExceptionHandler.mm | 2 +- Classes/BITCrashDetails.m | 2 +- Classes/BITCrashManager.m | 4 ++-- Classes/BITCrashReportTextFormatter.m | 2 +- Classes/BITFeedbackListViewCell.m | 2 +- Classes/BITFeedbackMessage.m | 2 +- Classes/BITFeedbackMessageAttachment.m | 2 +- Classes/BITHockeyAttachment.m | 2 +- Classes/BITHockeyBaseManager.m | 2 +- Classes/BITHockeyBaseViewController.m | 2 +- Classes/BITImageAnnotationViewController.m | 2 +- Classes/BITRectangleImageAnnotation.m | 2 +- Classes/BITStoreButton.m | 2 +- Classes/BITUpdateManager.m | 2 +- Classes/BITWebTableViewCell.m | 2 +- Classes/HockeySDKNullability.h | 2 +- Classes/HockeySDKPrivate.h | 2 +- 24 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Classes/BITActivityIndicatorButton.m b/Classes/BITActivityIndicatorButton.m index 340735fbfb..6a731bb434 100644 --- a/Classes/BITActivityIndicatorButton.m +++ b/Classes/BITActivityIndicatorButton.m @@ -79,4 +79,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITAppStoreHeader.m b/Classes/BITAppStoreHeader.m index 5c1e1cc6ba..f9a487e092 100644 --- a/Classes/BITAppStoreHeader.m +++ b/Classes/BITAppStoreHeader.m @@ -162,4 +162,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_UPDATES */ diff --git a/Classes/BITArrowImageAnnotation.m b/Classes/BITArrowImageAnnotation.m index d465d209e5..3f34459980 100644 --- a/Classes/BITArrowImageAnnotation.m +++ b/Classes/BITArrowImageAnnotation.m @@ -207,4 +207,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITAuthenticationViewController.m b/Classes/BITAuthenticationViewController.m index b46df8a5c6..f9a495a4fd 100644 --- a/Classes/BITAuthenticationViewController.m +++ b/Classes/BITAuthenticationViewController.m @@ -334,4 +334,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR */ diff --git a/Classes/BITAuthenticator.m b/Classes/BITAuthenticator.m index 9cd9d00d7b..7e7bb61194 100644 --- a/Classes/BITAuthenticator.m +++ b/Classes/BITAuthenticator.m @@ -996,4 +996,4 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; @end -#endif +#endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR */ diff --git a/Classes/BITAuthenticator_Private.h b/Classes/BITAuthenticator_Private.h index 852e9d11c2..6754a4ea0a 100644 --- a/Classes/BITAuthenticator_Private.h +++ b/Classes/BITAuthenticator_Private.h @@ -103,4 +103,4 @@ - (void) authenticate; @end -#endif +#endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR */ diff --git a/Classes/BITBlurImageAnnotation.m b/Classes/BITBlurImageAnnotation.m index d80c12fa87..62ba7517c5 100644 --- a/Classes/BITBlurImageAnnotation.m +++ b/Classes/BITBlurImageAnnotation.m @@ -104,4 +104,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITCrashCXXExceptionHandler.mm b/Classes/BITCrashCXXExceptionHandler.mm index b0991683f6..d4e8ab0393 100644 --- a/Classes/BITCrashCXXExceptionHandler.mm +++ b/Classes/BITCrashCXXExceptionHandler.mm @@ -236,4 +236,4 @@ static void BITCrashUncaughtCXXTerminateHandler(void) @end -#endif +#endif /* HOCKEYSDK_FEATURE_CRASH_REPORTER */ diff --git a/Classes/BITCrashDetails.m b/Classes/BITCrashDetails.m index 6c7820f05d..d5d5c9c69f 100644 --- a/Classes/BITCrashDetails.m +++ b/Classes/BITCrashDetails.m @@ -78,4 +78,4 @@ NSString *const kBITCrashKillSignal = @"SIGKILL"; @end -#endif +#endif /* HOCKEYSDK_FEATURE_CRASH_REPORTER */ diff --git a/Classes/BITCrashManager.m b/Classes/BITCrashManager.m index d27fecb407..2d446a5373 100644 --- a/Classes/BITCrashManager.m +++ b/Classes/BITCrashManager.m @@ -1106,7 +1106,7 @@ static void uncaught_cxx_exception_handler(const BITCrashUncaughtCXXExceptionInf #pragma clang diagnostic pop } } -#endif +#endif /* !defined (HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions) */ } else { [self approveLatestCrashReport]; @@ -1524,7 +1524,7 @@ static void uncaught_cxx_exception_handler(const BITCrashUncaughtCXXExceptionInf } #pragma clang diagnostic pop -#endif +#endif /* !defined (HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions) */ #pragma mark - Networking diff --git a/Classes/BITCrashReportTextFormatter.m b/Classes/BITCrashReportTextFormatter.m index aca1c8d6b4..1dd7cab44a 100644 --- a/Classes/BITCrashReportTextFormatter.m +++ b/Classes/BITCrashReportTextFormatter.m @@ -876,4 +876,4 @@ static const char *findSEL (const char *imageName, NSString *imageUUID, uint64_t @end -#endif +#endif /* HOCKEYSDK_FEATURE_CRASH_REPORTER */ diff --git a/Classes/BITFeedbackListViewCell.m b/Classes/BITFeedbackListViewCell.m index 5e6867a373..91dc8826bd 100644 --- a/Classes/BITFeedbackListViewCell.m +++ b/Classes/BITFeedbackListViewCell.m @@ -370,4 +370,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITFeedbackMessage.m b/Classes/BITFeedbackMessage.m index 2e97766c53..e0c05c4055 100644 --- a/Classes/BITFeedbackMessage.m +++ b/Classes/BITFeedbackMessage.m @@ -117,4 +117,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITFeedbackMessageAttachment.m b/Classes/BITFeedbackMessageAttachment.m index bc5f7f2e27..ab1e110b31 100644 --- a/Classes/BITFeedbackMessageAttachment.m +++ b/Classes/BITFeedbackMessageAttachment.m @@ -261,4 +261,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITHockeyAttachment.m b/Classes/BITHockeyAttachment.m index 4da8595797..d302609bfa 100644 --- a/Classes/BITHockeyAttachment.m +++ b/Classes/BITHockeyAttachment.m @@ -78,4 +78,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_CRASH_REPORTER || HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITHockeyBaseManager.m b/Classes/BITHockeyBaseManager.m index ecac046109..25410d14a8 100644 --- a/Classes/BITHockeyBaseManager.m +++ b/Classes/BITHockeyBaseManager.m @@ -293,7 +293,7 @@ [(BITHockeyBaseViewController *)viewController setModalAnimated:NO]; [visibleWindow addSubview:_navController.view]; } -#endif +#endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK */ } #endif // HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions && HOCKEYSDK_CONFIGURATION_RelaseCrashOnlyWatchOS diff --git a/Classes/BITHockeyBaseViewController.m b/Classes/BITHockeyBaseViewController.m index 96abc1213b..9c00c746b4 100644 --- a/Classes/BITHockeyBaseViewController.m +++ b/Classes/BITHockeyBaseViewController.m @@ -110,4 +110,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITImageAnnotationViewController.m b/Classes/BITImageAnnotationViewController.m index 81ce400231..347ea21273 100644 --- a/Classes/BITImageAnnotationViewController.m +++ b/Classes/BITImageAnnotationViewController.m @@ -419,4 +419,4 @@ typedef NS_ENUM(NSInteger, BITImageAnnotationViewControllerInteractionMode) { } @end -#endif +#endif /* HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITRectangleImageAnnotation.m b/Classes/BITRectangleImageAnnotation.m index f6b03fea73..4f21f6a904 100644 --- a/Classes/BITRectangleImageAnnotation.m +++ b/Classes/BITRectangleImageAnnotation.m @@ -89,4 +89,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITStoreButton.m b/Classes/BITStoreButton.m index fb5f1ba133..40f3484aeb 100644 --- a/Classes/BITStoreButton.m +++ b/Classes/BITStoreButton.m @@ -276,4 +276,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_UPDATES */ diff --git a/Classes/BITUpdateManager.m b/Classes/BITUpdateManager.m index 0f52f73b2a..e6784aed30 100644 --- a/Classes/BITUpdateManager.m +++ b/Classes/BITUpdateManager.m @@ -970,7 +970,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { return success; -#endif +#endif /* TARGET_IPHONE_SIMULATOR */ } diff --git a/Classes/BITWebTableViewCell.m b/Classes/BITWebTableViewCell.m index 7948cf631e..584d6b03d6 100644 --- a/Classes/BITWebTableViewCell.m +++ b/Classes/BITWebTableViewCell.m @@ -183,4 +183,4 @@ body { font: 13px 'Helvetica Neue', Helvetica; color:#626262; word-wrap:break-wo @end -#endif +#endif /* HOCKEYSDK_FEATURE_UPDATES */ diff --git a/Classes/HockeySDKNullability.h b/Classes/HockeySDKNullability.h index 5a2be266d0..8fdddd4b21 100644 --- a/Classes/HockeySDKNullability.h +++ b/Classes/HockeySDKNullability.h @@ -30,4 +30,4 @@ #define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") #endif -#endif +#endif /* HockeySDK_HockeyNullability_h */ diff --git a/Classes/HockeySDKPrivate.h b/Classes/HockeySDKPrivate.h index b10068f17c..b4f57e5044 100644 --- a/Classes/HockeySDKPrivate.h +++ b/Classes/HockeySDKPrivate.h @@ -90,4 +90,4 @@ NSString *BITHockeyMD5(NSString *str); #endif -#endif //HockeySDK_HockeySDKPrivate_h +#endif /* HockeySDK_HockeySDKPrivate_h */ From 96cfb169b6ac8b59230bebb8ee3b9429427a2798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Tue, 29 Sep 2015 16:38:11 +0200 Subject: [PATCH 05/16] Switch back to using UIAlertView We won't use UIAlertController for now until we have a more robust solution for displaying it without knowing the currently presented view controller. --- Classes/BITAuthenticationViewController.m | 5 +++-- Classes/BITAuthenticator.m | 5 +++-- Classes/BITCrashManager.m | 4 +++- Classes/BITFeedbackComposeViewController.m | 5 +++-- Classes/BITFeedbackListViewController.m | 8 +++++-- Classes/BITFeedbackManager.m | 4 +++- Classes/BITHockeyBaseManager.m | 3 ++- Classes/BITHockeyBaseManagerPrivate.h | 4 +++- Classes/BITStoreUpdateManager.m | 5 +++-- Classes/BITUpdateManager.m | 26 +++++++++++++++------- 10 files changed, 47 insertions(+), 22 deletions(-) diff --git a/Classes/BITAuthenticationViewController.m b/Classes/BITAuthenticationViewController.m index f9a495a4fd..addbfd1815 100644 --- a/Classes/BITAuthenticationViewController.m +++ b/Classes/BITAuthenticationViewController.m @@ -294,7 +294,7 @@ if(succeeded) { //controller should dismiss us shortly.. } else { - + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -311,6 +311,7 @@ [self presentViewController:alertController animated:YES completion:nil]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil @@ -320,7 +321,7 @@ otherButtonTitles:nil]; [alertView show]; #pragma clang diagnostic pop - } + /*}*/ typeof(self) strongSelf = weakSelf; [strongSelf setLoginUIEnabled:YES]; } diff --git a/Classes/BITAuthenticator.m b/Classes/BITAuthenticator.m index 7e7bb61194..753bd51465 100644 --- a/Classes/BITAuthenticator.m +++ b/Classes/BITAuthenticator.m @@ -255,7 +255,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; [self dismissAuthenticationControllerAnimated:YES completion:nil]; } else { BITHockeyLog(@"Validation failed with error: %@", error); - + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -277,6 +277,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; [self showAlertController:alertController]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil @@ -287,7 +288,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; [alertView setTag:0]; [alertView show]; #pragma clang diagnostic pop - } + /*}*/ } }]; } diff --git a/Classes/BITCrashManager.m b/Classes/BITCrashManager.m index 2d446a5373..59060c5d15 100644 --- a/Classes/BITCrashManager.m +++ b/Classes/BITCrashManager.m @@ -1048,6 +1048,7 @@ static void uncaught_cxx_exception_handler(const BITCrashUncaughtCXXExceptionInf if (_alertViewHandler) { _alertViewHandler(); } else { + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -1090,6 +1091,7 @@ static void uncaught_cxx_exception_handler(const BITCrashUncaughtCXXExceptionInf [self showAlertController:alertController]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:BITHockeyLocalizedString(@"CrashDataFoundTitle"), appName] @@ -1104,7 +1106,7 @@ static void uncaught_cxx_exception_handler(const BITCrashUncaughtCXXExceptionInf [alertView show]; #pragma clang diagnostic pop - } + /*}*/ } #endif /* !defined (HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions) */ diff --git a/Classes/BITFeedbackComposeViewController.m b/Classes/BITFeedbackComposeViewController.m index 33dc781dc7..4620bd9738 100644 --- a/Classes/BITFeedbackComposeViewController.m +++ b/Classes/BITFeedbackComposeViewController.m @@ -538,7 +538,7 @@ NSInteger index = [self.attachmentScrollViewImageViews indexOfObject:sender]; self.selectedAttachmentIndex = (self.attachmentScrollViewImageViews.count - index - 1); - + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -578,6 +578,7 @@ [self presentViewController:alertController animated:YES completion:nil]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle: nil @@ -588,7 +589,7 @@ [actionSheet showFromRect: sender.frame inView: self.attachmentScrollView animated: YES]; #pragma clang diagnostic push - } + /*}*/ _actionSheetVisible = YES; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { diff --git a/Classes/BITFeedbackListViewController.m b/Classes/BITFeedbackListViewController.m index c7b74388a4..8d2ef7a173 100644 --- a/Classes/BITFeedbackListViewController.m +++ b/Classes/BITFeedbackListViewController.m @@ -289,6 +289,7 @@ } - (void)deleteAllMessagesAction:(id)sender { + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -326,6 +327,7 @@ [self presentViewController:alertController animated:YES completion:nil]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) { @@ -349,7 +351,7 @@ [deleteAction show]; } #pragma clang diagnostic pop - } + /*}*/ } - (UIView*) viewForShowingActionSheetOnPhone { @@ -828,6 +830,7 @@ #pragma mark - BITAttributedLabelDelegate - (void)attributedLabel:(BITAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url { + /* // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -867,6 +870,7 @@ [self presentViewController:linkAction animated:YES completion:nil]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) { @@ -891,7 +895,7 @@ [linkAction show]; } #pragma clang diagnostic pop - } + /*}*/ } diff --git a/Classes/BITFeedbackManager.m b/Classes/BITFeedbackManager.m index e3a5fe5f86..0caec16a9b 100644 --- a/Classes/BITFeedbackManager.m +++ b/Classes/BITFeedbackManager.m @@ -799,6 +799,7 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac } if(self.showAlertOnIncomingMessages && !self.currentFeedbackListViewController && !self.currentFeedbackComposeViewController) { + /* // Requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -819,6 +820,7 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac [self showAlertController:alertController]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageTitle") @@ -830,7 +832,7 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac [alertView setTag:0]; [alertView show]; #pragma clang diagnostic pop - } + /*}*/ _incomingMessagesAlertShowing = YES; } } diff --git a/Classes/BITHockeyBaseManager.m b/Classes/BITHockeyBaseManager.m index 25410d14a8..74c9810cd8 100644 --- a/Classes/BITHockeyBaseManager.m +++ b/Classes/BITHockeyBaseManager.m @@ -232,7 +232,7 @@ return parentViewController; } - +/* We won't use this for now until we have a more robust solution for displaying UIAlertController - (void)showAlertController:(UIViewController *)alertController { // always execute this on the main thread @@ -252,6 +252,7 @@ } }); } +*/ - (void)showView:(UIViewController *)viewController { // if we compile Crash only, then BITHockeyBaseViewController is not included diff --git a/Classes/BITHockeyBaseManagerPrivate.h b/Classes/BITHockeyBaseManagerPrivate.h index 9c42123766..36828334ca 100644 --- a/Classes/BITHockeyBaseManagerPrivate.h +++ b/Classes/BITHockeyBaseManagerPrivate.h @@ -80,8 +80,10 @@ * * @param alertController The UIAlertController to be presented. */ +/* We won't use this for now until we have a more robust solution for displaying UIAlertController - (void)showAlertController:(UIViewController *)alertController; -- (void)showView:(UIViewController *)viewController; +*/ + - (void)showView:(UIViewController *)viewController; #endif // Date helpers diff --git a/Classes/BITStoreUpdateManager.m b/Classes/BITStoreUpdateManager.m index dfca526b9a..cd6d8e70f2 100644 --- a/Classes/BITStoreUpdateManager.m +++ b/Classes/BITStoreUpdateManager.m @@ -435,7 +435,7 @@ - (void)showUpdateAlert { if (!_updateAlertShowing) { NSString *versionString = [NSString stringWithFormat:@"%@ %@", BITHockeyLocalizedString(@"UpdateVersion"), _newStoreVersion]; - + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -475,6 +475,7 @@ [self showAlertController:alertController]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"UpdateAvailable") @@ -485,7 +486,7 @@ ]; [alertView show]; #pragma clang diagnostic pop - } + /*}*/ _updateAlertShowing = YES; } diff --git a/Classes/BITUpdateManager.m b/Classes/BITUpdateManager.m index e6784aed30..249d214d27 100644 --- a/Classes/BITUpdateManager.m +++ b/Classes/BITUpdateManager.m @@ -93,6 +93,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { // only show error if we enable that if (_showFeedback) { + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -109,6 +110,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [self showAlertController:alertController]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alert = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"UpdateError") @@ -118,7 +120,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { otherButtonTitles:nil]; [alert show]; #pragma clang diagnostic pop - } + /*}*/ _showFeedback = NO; } } @@ -555,6 +557,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { NSString *title = BITHockeyLocalizedString(@"UpdateAvailable"); NSString *message = [NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateAlertMandatoryTextWithAppVersion"), [self.newestAppVersion nameAndVersionString]]; if ([self hasNewerMandatoryVersion]) { + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -589,6 +592,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [self showAlertController:alertController]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title @@ -600,11 +604,11 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [alertView setTag:BITUpdateAlertViewTagMandatoryUpdate]; [alertView show]; #pragma clang diagnostic pop - } + /*}*/ _updateAlertShowing = YES; } else { message = [NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateAlertTextWithAppVersion"), [self.newestAppVersion nameAndVersionString]]; - + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -653,6 +657,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [self showAlertController:alertController ]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title @@ -667,7 +672,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [alertView setTag:BITUpdateAlertViewTagDefaultUpdate]; [alertView show]; #pragma clang diagnostic pop - } + /*}*/ _updateAlertShowing = YES; } } @@ -741,6 +746,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { // nag the user with neverending alerts if we cannot find out the window for presenting the covering sheet - (void)alertFallback:(NSString *)message { + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -772,6 +778,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [self showAlertController:alertController]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil @@ -787,7 +794,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [alertView setTag:BITUpdateAlertViewTagNeverEndingAlertView]; [alertView show]; - } + /*}*/ } #pragma mark - RequestComments @@ -917,6 +924,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { } #if TARGET_IPHONE_SIMULATOR + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -932,6 +940,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [self showAlertController:alertController]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alert = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"UpdateWarning") @@ -941,7 +950,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { otherButtonTitles:nil]; [alert show]; #pragma clang diagnostic pop - } + /*}*/ return NO; #else @@ -1090,7 +1099,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { versionString = [shortVersionString length] ? [NSString stringWithFormat:@"(%@)", versionString] : versionString; NSString *currentVersionString = [NSString stringWithFormat:@"%@ %@ %@%@", self.newestAppVersion.name, BITHockeyLocalizedString(@"UpdateVersion"), shortVersionString, versionString]; NSString *alertMsg = [NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateNoUpdateAvailableMessage"), currentVersionString]; - + /* We won't use this for now until we have a more robust solution for displaying UIAlertController // requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -1114,6 +1123,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [self showAlertController:alertController]; } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alert = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"UpdateNoUpdateAvailableTitle") @@ -1123,7 +1133,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { otherButtonTitles:nil]; [alert show]; #pragma clang diagnostic pop - } + /*}*/ } if (self.isUpdateAvailable && (self.alwaysShowUpdateReminder || newVersionDiffersFromCachedVersion || [self hasNewerMandatoryVersion])) { From c5205e8b18e607fcca5954b4694b1d73af167395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Wed, 30 Sep 2015 12:38:15 +0200 Subject: [PATCH 06/16] Fix typo in installation setup template --- docs/Guide-Installation-Setup-template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Guide-Installation-Setup-template.md b/docs/Guide-Installation-Setup-template.md index 0d09775c84..47a17157f5 100644 --- a/docs/Guide-Installation-Setup-template.md +++ b/docs/Guide-Installation-Setup-template.md @@ -188,7 +188,7 @@ pod "HockeySDK-Source" -### 3.3 iOExtensions +### 3.3 iOS Extensions The following points need to be considered to use the HockeySDK SDK with iOS Extensions: From 5e1b3a3ef95b8654185804e98a279dddf2653fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Thu, 1 Oct 2015 15:00:37 +0200 Subject: [PATCH 07/16] Run UI code in authenticator completions on main queue --- Classes/BITAuthenticationViewController.m | 47 +++++---- Classes/BITAuthenticator.m | 116 ++++++++++++---------- 2 files changed, 86 insertions(+), 77 deletions(-) diff --git a/Classes/BITAuthenticationViewController.m b/Classes/BITAuthenticationViewController.m index addbfd1815..687ab947c5 100644 --- a/Classes/BITAuthenticationViewController.m +++ b/Classes/BITAuthenticationViewController.m @@ -93,7 +93,7 @@ [self updateBarButtons]; [self updateWebLoginButton]; } - } + } } - (void) updateWebLoginButton { @@ -279,7 +279,7 @@ [self saveAction:nil]; } } - return NO; + return NO; } #pragma mark - Actions @@ -294,24 +294,26 @@ if(succeeded) { //controller should dismiss us shortly.. } else { - /* We won't use this for now until we have a more robust solution for displaying UIAlertController - // requires iOS 8 - id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); - if (uialertcontrollerClass) { - UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil - message:error.localizedDescription - preferredStyle:UIAlertControllerStyleAlert]; + dispatch_async(dispatch_get_main_queue(), ^{ - - UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"OK") - style:UIAlertActionStyleCancel - handler:^(UIAlertAction * action) {}]; - - [alertController addAction:okAction]; - - [self presentViewController:alertController animated:YES completion:nil]; - } else { - */ + /* We won't use this for now until we have a more robust solution for displaying UIAlertController + // requires iOS 8 + id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); + if (uialertcontrollerClass) { + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil + message:error.localizedDescription + preferredStyle:UIAlertControllerStyleAlert]; + + + UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"OK") + style:UIAlertActionStyleCancel + handler:^(UIAlertAction * action) {}]; + + [alertController addAction:okAction]; + + [self presentViewController:alertController animated:YES completion:nil]; + } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil @@ -321,9 +323,10 @@ otherButtonTitles:nil]; [alertView show]; #pragma clang diagnostic pop - /*}*/ - typeof(self) strongSelf = weakSelf; - [strongSelf setLoginUIEnabled:YES]; + /*}*/ + typeof(self) strongSelf = weakSelf; + [strongSelf setLoginUIEnabled:YES]; + }); } }]; } diff --git a/Classes/BITAuthenticator.m b/Classes/BITAuthenticator.m index 753bd51465..68932a0c60 100644 --- a/Classes/BITAuthenticator.m +++ b/Classes/BITAuthenticator.m @@ -89,9 +89,11 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; } #pragma mark - +/** + * This method has to be called on the main queue + */ - (void)dismissAuthenticationControllerAnimated:(BOOL)animated completion:(void (^)(void))completion { if (!_authenticationController) return; - UIViewController *presentingViewController = [_authenticationController presentingViewController]; // If there is no presenting view controller just remove view @@ -163,7 +165,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateActive) { return; } - + NSLog(@"[HockeySDK] ERROR: The authentication token could not be stored due to a keychain error. This is most likely a signing or keychain entitlement issue!"); } @@ -251,33 +253,34 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; - (void) validate { [self validateWithCompletion:^(BOOL validated, NSError *error) { - if(validated) { - [self dismissAuthenticationControllerAnimated:YES completion:nil]; - } else { - BITHockeyLog(@"Validation failed with error: %@", error); - /* We won't use this for now until we have a more robust solution for displaying UIAlertController - // requires iOS 8 - id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); - if (uialertcontrollerClass) { - __weak typeof(self) weakSelf = self; - - UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil - message:error.localizedDescription - preferredStyle:UIAlertControllerStyleAlert]; - - - UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK") - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { - typeof(self) strongSelf = weakSelf; - [strongSelf validate]; - }]; - - [alertController addAction:okAction]; - - [self showAlertController:alertController]; + dispatch_async(dispatch_get_main_queue(), ^{ + if(validated) { + [self dismissAuthenticationControllerAnimated:YES completion:nil]; } else { - */ + BITHockeyLog(@"Validation failed with error: %@", error); + /* We won't use this for now until we have a more robust solution for displaying UIAlertController + // requires iOS 8 + id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); + if (uialertcontrollerClass) { + __weak typeof(self) weakSelf = self; + + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil + message:error.localizedDescription + preferredStyle:UIAlertControllerStyleAlert]; + + + UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { + typeof(self) strongSelf = weakSelf; + [strongSelf validate]; + }]; + + [alertController addAction:okAction]; + + [self showAlertController:alertController]; + } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil @@ -288,8 +291,9 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; [alertView setTag:0]; [alertView show]; #pragma clang diagnostic pop - /*}*/ - } + /*}*/ + } + }); }]; } @@ -361,7 +365,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; } } -- (void)handleValidationResponseWithData:(NSData *) responseData error:(NSError *)error completion:(void (^)(BOOL validated, NSError *))completion { +- (void)handleValidationResponseWithData:(NSData *)responseData error:(NSError *)error completion:(void (^)(BOOL validated, NSError *))completion { if(nil == responseData) { NSDictionary *userInfo = @{NSLocalizedDescriptionKey : BITHockeyLocalizedString(@"HockeyAuthenticationFailedAuthenticate")}; if(error) { @@ -373,7 +377,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; code:BITAuthenticatorNetworkError userInfo:userInfo]; self.validated = NO; - if(completion) completion(NO, error); + if(completion) { completion(NO, error); } } else { NSError *validationParseError = nil; BOOL valid = [self.class isValidationResponseValid:responseData error:&validationParseError]; @@ -381,11 +385,11 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; if(valid) { [self setLastAuthenticatedVersion:self.executableUUID]; } - if(completion) completion(valid, validationParseError); + if(completion) { completion(valid, validationParseError); } } } -- (NSDictionary*) validationParameters { +- (NSDictionary*)validationParameters { NSParameterAssert(self.installationIdentifier); NSParameterAssert(self.installationIdentifierParameterString); @@ -397,7 +401,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; return @{self.installationIdentifierParameterString : self.installationIdentifier}; } -+ (BOOL) isValidationResponseValid:(id) response error:(NSError **) error { ++ (BOOL)isValidationResponseValid:(id)response error:(NSError **)error { NSParameterAssert(response); NSError *jsonParseError = nil; @@ -457,7 +461,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; NSParameterAssert(self.identificationType == BITAuthenticatorIdentificationTypeHockeyAppEmail || (password && password.length)); NSURLRequest* request = [self requestForAuthenticationEmail:email password:password]; - + id nsurlsessionClass = NSClassFromString(@"NSURLSessionUploadTask"); BOOL isURLSessionSupported = (nsurlsessionClass && !bit_isRunningInAppExtension()); @@ -467,7 +471,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; - (void)authenticationViewController:(UIViewController *)viewController handleAuthenticationWithEmail:(NSString *)email request:(NSURLRequest *)request - urlSessionSupported:(BOOL)isURLSessionSupported + urlSessionSupported:(BOOL)isURLSessionSupported completion:(void (^)(BOOL, NSError *))completion { __weak typeof (self) weakSelf = self; if(isURLSessionSupported) { @@ -494,8 +498,8 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; - (void)handleAuthenticationWithResponse:(NSHTTPURLResponse *)response email:(NSString *)email data:(NSData *)data completion:(void (^)(BOOL, NSError *))completion{ NSError *authParseError = nil; NSString *authToken = [self.class authenticationTokenFromURLResponse:response - data:data - error:&authParseError]; + data:data + error:&authParseError]; BOOL identified; if(authToken) { identified = YES; @@ -510,9 +514,11 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; identified = NO; } self.identified = identified; - completion(identified, authParseError); - if(self.identificationCompletion) self.identificationCompletion(identified, authParseError); - self.identificationCompletion = nil; + if (completion) { completion(identified, authParseError); } + if(self.identificationCompletion) { + self.identificationCompletion(identified, authParseError); + self.identificationCompletion = nil; + } } - (NSURLRequest *) requestForAuthenticationEmail:(NSString*) email password:(NSString*) password { @@ -523,7 +529,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; if (installString) { params[@"install_string"] = installString; } - + if(BITAuthenticatorIdentificationTypeHockeyAppEmail == self.identificationType) { NSString *authCode = BITHockeyMD5([NSString stringWithFormat:@"%@%@", self.authenticationSecret ? : @"", @@ -798,7 +804,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; free(source); return; } - + if ((fs.st_size < 20) || (memcmp(source, kBITPNGHeader, 8))) { // Not a PNG free(source); @@ -806,7 +812,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; } buffer = source + 8; - + NSString *result = nil; bit_uint32 length; unsigned char *name; @@ -827,7 +833,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; if (bytes_left >= length) { memcpy(data, buffer, length); - + buffer += length; buffer += 4; if (!strcmp((const char *)name, "tEXt")) { @@ -843,7 +849,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; chunk_index = 128; } } - + free(data); free(name); @@ -874,12 +880,12 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; } if(nil == _appDidEnterBackgroundObserver) { _appDidEnterBackgroundObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification - object:nil - queue:NSOperationQueue.mainQueue - usingBlock:^(NSNotification *note) { - typeof(self) strongSelf = weakSelf; - [strongSelf applicationDidEnterBackground:note]; - }]; + object:nil + queue:NSOperationQueue.mainQueue + usingBlock:^(NSNotification *note) { + typeof(self) strongSelf = weakSelf; + [strongSelf applicationDidEnterBackground:note]; + }]; } } @@ -901,10 +907,10 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; [self removeKeyFromKeychain:kBITAuthenticatorIdentifierTypeKey]; } else { BOOL success1 = [self addStringValueToKeychainForThisDeviceOnly:installationIdentifier - forKey:kBITAuthenticatorIdentifierKey]; + forKey:kBITAuthenticatorIdentifierKey]; NSParameterAssert(success1); BOOL success2 = [self addStringValueToKeychainForThisDeviceOnly:[self.class stringForIdentificationType:type] - forKey:kBITAuthenticatorIdentifierTypeKey]; + forKey:kBITAuthenticatorIdentifierTypeKey]; NSParameterAssert(success2); if (!success1 || !success2) { [self alertOnFailureStoringTokenInKeychain]; From 02f73a31d202c34f9a8f4eddc3afa9ea80b17808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Thu, 1 Oct 2015 15:11:02 +0200 Subject: [PATCH 08/16] Use https directly to query Apple's search API Although the http URL automatically redirects, we can obviously make this more clear by using https directly. --- Classes/BITStoreUpdateManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/BITStoreUpdateManager.m b/Classes/BITStoreUpdateManager.m index cd6d8e70f2..c43eda552b 100644 --- a/Classes/BITStoreUpdateManager.m +++ b/Classes/BITStoreUpdateManager.m @@ -342,7 +342,7 @@ NSString *appBundleIdentifier = [self.mainBundle objectForInfoDictionaryKey:@"CFBundleIdentifier"]; - NSString *url = [NSString stringWithFormat:@"http://itunes.apple.com/lookup?bundleId=%@%@", + NSString *url = [NSString stringWithFormat:@"https://itunes.apple.com/lookup?bundleId=%@%@", bit_URLEncodedString(appBundleIdentifier), country]; From 5303ebc414817bcad6fa78f487faa1fa3af9d252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Thu, 1 Oct 2015 15:29:45 +0200 Subject: [PATCH 09/16] Always present feedback alerts using main queue --- Classes/BITFeedbackManager.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Classes/BITFeedbackManager.m b/Classes/BITFeedbackManager.m index 0caec16a9b..e24f110eb4 100644 --- a/Classes/BITFeedbackManager.m +++ b/Classes/BITFeedbackManager.m @@ -799,6 +799,7 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac } if(self.showAlertOnIncomingMessages && !self.currentFeedbackListViewController && !self.currentFeedbackComposeViewController) { + dispatch_async(dispatch_get_main_queue(), ^{ /* // Requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); @@ -817,9 +818,9 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac }]; [alertController addAction:cancelAction]; [alertController addAction:showAction]; - - [self showAlertController:alertController]; - } else { + + [self showAlertController:alertController]; + } else { */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" @@ -832,8 +833,9 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac [alertView setTag:0]; [alertView show]; #pragma clang diagnostic pop - /*}*/ - _incomingMessagesAlertShowing = YES; + /*}*/ + _incomingMessagesAlertShowing = YES; + }); } } } From 230ac861308b7acaf2bfb12cc83ca79141004663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Thu, 1 Oct 2015 15:30:34 +0200 Subject: [PATCH 10/16] Make sure `showView:` method always runs on main queue --- Classes/BITHockeyBaseManager.m | 66 +++++++++++++++++----------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/Classes/BITHockeyBaseManager.m b/Classes/BITHockeyBaseManager.m index 74c9810cd8..d2dd74aa66 100644 --- a/Classes/BITHockeyBaseManager.m +++ b/Classes/BITHockeyBaseManager.m @@ -258,42 +258,44 @@ // if we compile Crash only, then BITHockeyBaseViewController is not included // in the headers and will cause a warning with the modulemap file #if HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK - UIViewController *parentViewController = [self visibleWindowRootViewController]; + dispatch_async(dispatch_get_main_queue(), ^{ + UIViewController *parentViewController = [self visibleWindowRootViewController]; - // as per documentation this only works if called from within viewWillAppear: or viewDidAppear: - // in tests this also worked fine on iOS 6 and 7 but not on iOS 5 so we are still trying this - if ([parentViewController isBeingPresented]) { - BITHockeyLog(@"WARNING: There is already a view controller being presented onto the parentViewController. Delaying presenting the new view controller by 0.5s."); - [self performSelector:@selector(showView:) withObject:viewController afterDelay:0.5]; - return; - } - - if (_navController != nil) _navController = nil; - - _navController = [self customNavigationControllerWithRootViewController:viewController presentationStyle:_modalPresentationStyle]; - - if (parentViewController) { - _navController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; - - // page sheet for the iPad - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - _navController.modalPresentationStyle = UIModalPresentationFormSheet; + // as per documentation this only works if called from within viewWillAppear: or viewDidAppear: + // in tests this also worked fine on iOS 6 and 7 but not on iOS 5 so we are still trying this + if ([parentViewController isBeingPresented]) { + BITHockeyLog(@"WARNING: There is already a view controller being presented onto the parentViewController. Delaying presenting the new view controller by 0.5s."); + [self performSelector:@selector(showView:) withObject:viewController afterDelay:0.5]; + return; } - if ([viewController isKindOfClass:[BITHockeyBaseViewController class]]) - [(BITHockeyBaseViewController *)viewController setModalAnimated:YES]; + if (_navController != nil) _navController = nil; - [parentViewController presentViewController:_navController animated:YES completion:nil]; - } else { - // if not, we add a subview to the window. A bit hacky but should work in most circumstances. - // Also, we don't get a nice animation for free, but hey, this is for beta not production users ;) - UIWindow *visibleWindow = [self findVisibleWindow]; - - BITHockeyLog(@"INFO: No rootViewController found, using UIWindow-approach: %@", visibleWindow); - if ([viewController isKindOfClass:[BITHockeyBaseViewController class]]) - [(BITHockeyBaseViewController *)viewController setModalAnimated:NO]; - [visibleWindow addSubview:_navController.view]; - } + _navController = [self customNavigationControllerWithRootViewController:viewController presentationStyle:_modalPresentationStyle]; + + if (parentViewController) { + _navController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; + + // page sheet for the iPad + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { + _navController.modalPresentationStyle = UIModalPresentationFormSheet; + } + + if ([viewController isKindOfClass:[BITHockeyBaseViewController class]]) + [(BITHockeyBaseViewController *)viewController setModalAnimated:YES]; + + [parentViewController presentViewController:_navController animated:YES completion:nil]; + } else { + // if not, we add a subview to the window. A bit hacky but should work in most circumstances. + // Also, we don't get a nice animation for free, but hey, this is for beta not production users ;) + UIWindow *visibleWindow = [self findVisibleWindow]; + + BITHockeyLog(@"INFO: No rootViewController found, using UIWindow-approach: %@", visibleWindow); + if ([viewController isKindOfClass:[BITHockeyBaseViewController class]]) + [(BITHockeyBaseViewController *)viewController setModalAnimated:NO]; + [visibleWindow addSubview:_navController.view]; + } + }); #endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK */ } #endif // HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions && HOCKEYSDK_CONFIGURATION_RelaseCrashOnlyWatchOS From 30f27eae8f03af8e9978a4d477c3c2540a025677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Thu, 1 Oct 2015 17:04:23 +0200 Subject: [PATCH 11/16] Small code refactorings and improvements --- Classes/BITFeedbackManager.m | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Classes/BITFeedbackManager.m b/Classes/BITFeedbackManager.m index e24f110eb4..4a9918edae 100644 --- a/Classes/BITFeedbackManager.m +++ b/Classes/BITFeedbackManager.m @@ -857,7 +857,7 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac } -- (void)sendNetworkRequestWithHTTPMethod:(NSString *)httpMethod withMessage:(BITFeedbackMessage *)message completionHandler:(void (^)(NSError *err))completionHandler { +- (void)sendNetworkRequestWithHTTPMethod:(NSString *)httpMethod withMessage:(BITFeedbackMessage *)message completionHandler:(void (^)(NSError *error))completionHandler { NSString *boundary = @"----FOO"; _networkRequestInProgress = YES; @@ -961,22 +961,24 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac }else{ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *err) { + [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *error) { #pragma clang diagnostic pop typeof (self) strongSelf = weakSelf; - [strongSelf handleFeedbackMessageResponse:response data:responseData error:err completion:completionHandler]; + [strongSelf handleFeedbackMessageResponse:response data:responseData error:error completion:completionHandler]; }]; } } -- (void)handleFeedbackMessageResponse:(NSURLResponse *)response data:(NSData *)responseData error:(NSError * )err completion:(void (^)(NSError *err))completionHandler{ +- (void)handleFeedbackMessageResponse:(NSURLResponse *)response data:(NSData *)responseData error:(NSError * )error completion:(void (^)(NSError *error))completionHandler{ _networkRequestInProgress = NO; - if (err) { - [self reportError:err]; + if (error) { + [self reportError:error]; [self markSendInProgressMessagesAsPending]; - completionHandler(err); + if (completionHandler) { + completionHandler(error); + } } else { NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode]; if (statusCode == 404) { @@ -1035,7 +1037,9 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac } [self markSendInProgressMessagesAsPending]; - completionHandler(err); + if (completionHandler) { + completionHandler(error); + } } } @@ -1049,7 +1053,7 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac [self sendNetworkRequestWithHTTPMethod:@"GET" withMessage:nil - completionHandler:^(NSError *err){ + completionHandler:^(NSError *error){ // inform the UI to update its data in case the list is already showing [[NSNotificationCenter defaultCenter] postNotificationName:BITHockeyFeedbackMessagesLoadingFinished object:nil]; }]; @@ -1070,7 +1074,7 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac if ([pendingMessages count] > 0) { // we send one message at a time - BITFeedbackMessage *messageToSend = [pendingMessages objectAtIndex:0]; + BITFeedbackMessage *messageToSend = pendingMessages[0]; [messageToSend setStatus:BITFeedbackMessageStatusSendInProgress]; if (self.userID) @@ -1087,8 +1091,8 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac [self sendNetworkRequestWithHTTPMethod:httpMethod withMessage:messageToSend - completionHandler:^(NSError *err){ - if (err) { + completionHandler:^(NSError *error){ + if (error) { [self markSendInProgressMessagesAsPending]; [self saveMessages]; } From 44b231225cb177bd54a1a4a5dbbee6713f572793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Thu, 1 Oct 2015 17:04:46 +0200 Subject: [PATCH 12/16] Silence AssetLibrary deprecation warning while we work to replace it --- Classes/BITFeedbackManager.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Classes/BITFeedbackManager.m b/Classes/BITFeedbackManager.m index 4a9918edae..b4e34fa474 100644 --- a/Classes/BITFeedbackManager.m +++ b/Classes/BITFeedbackManager.m @@ -1186,6 +1186,8 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac } -(void)extractLastPictureFromLibraryAndLaunchFeedback { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) { @@ -1205,6 +1207,7 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac } }]; } failureBlock: nil]; +#pragma clang diagnostic pop } - (void)screenshotTripleTap:(UITapGestureRecognizer *)tapRecognizer { From bccfc61a4236df1811aebc2070bfc32d1a7432da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Mon, 5 Oct 2015 13:52:24 +0200 Subject: [PATCH 13/16] Add warnings to docs for threading, properly dispatch internally --- Classes/BITAuthenticator.h | 4 ++-- Classes/BITAuthenticator.m | 6 ++++-- Classes/BITFeedbackManager.h | 6 ++++++ Classes/BITFeedbackManager.m | 11 ++++++----- Classes/BITHockeyBaseManager.m | 2 -- Classes/BITUpdateManager.h | 2 ++ Classes/BITUpdateManager.m | 4 +++- 7 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Classes/BITAuthenticator.h b/Classes/BITAuthenticator.h index e740a2c9e2..df64cf3de6 100644 --- a/Classes/BITAuthenticator.h +++ b/Classes/BITAuthenticator.h @@ -313,7 +313,7 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency) * @see authenticateInstallation * @see validateWithCompletion: * - * @param completion Block being executed once identification completed + * @param completion Block being executed once identification completed. Be sure to properly dispatch code to the main queue if necessary. */ - (void) identifyWithCompletion:(void(^)(BOOL identified, NSError *error)) completion; @@ -342,7 +342,7 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency) * @see authenticateInstallation * @see identifyWithCompletion: * - * @param completion Block being executed once validation completed + * @param completion Block being executed once validation completed. Be sure to properly dispatch code to the main queue if necessary. */ - (void) validateWithCompletion:(void(^)(BOOL validated, NSError *error)) completion; diff --git a/Classes/BITAuthenticator.m b/Classes/BITAuthenticator.m index 68932a0c60..6beccedd16 100644 --- a/Classes/BITAuthenticator.m +++ b/Classes/BITAuthenticator.m @@ -169,7 +169,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; NSLog(@"[HockeySDK] ERROR: The authentication token could not be stored due to a keychain error. This is most likely a signing or keychain entitlement issue!"); } -- (void) identifyWithCompletion:(void (^)(BOOL identified, NSError *))completion { +- (void)identifyWithCompletion:(void (^)(BOOL identified, NSError *))completion { if(_authenticationController) { BITHockeyLog(@"Authentication controller already visible. Ignoring identify request"); if(completion) completion(NO, nil); @@ -246,7 +246,9 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; viewController.email = [self stringValueFromKeychainForKey:kBITAuthenticatorUserEmailKey]; _authenticationController = viewController; _identificationCompletion = completion; - [self showView:viewController]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self showView:viewController]; + }); } #pragma mark - Validation diff --git a/Classes/BITFeedbackManager.h b/Classes/BITFeedbackManager.h index 100ef9399f..5c456e6b54 100644 --- a/Classes/BITFeedbackManager.h +++ b/Classes/BITFeedbackManager.h @@ -287,6 +287,8 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) { /** Present the modal feedback list user interface. + + @warning This methods needs to be called on the main thread! */ - (void)showFeedbackListView; @@ -303,6 +305,8 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) { /** Present the modal feedback compose message user interface. + + @warning This methods needs to be called on the main thread! */ - (void)showFeedbackComposeView; @@ -314,6 +318,7 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) { @param items an NSArray with objects that should be attached @see `[BITFeedbackComposeViewController prepareWithItems:]` + @warning This methods needs to be called on the main thread! */ - (void)showFeedbackComposeViewWithPreparedItems:(NSArray *)items; @@ -325,6 +330,7 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) { [[BITHockeyManager sharedHockeyManager].feedbackManager showFeedbackComposeViewWithGeneratedScreenshot]; @see feedbackObservationMode + @warning This methods needs to be called on the main thread! */ - (void)showFeedbackComposeViewWithGeneratedScreenshot; diff --git a/Classes/BITFeedbackManager.m b/Classes/BITFeedbackManager.m index b4e34fa474..c2c2b31497 100644 --- a/Classes/BITFeedbackManager.m +++ b/Classes/BITFeedbackManager.m @@ -220,8 +220,9 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac BITHockeyLog(@"INFO: update view already visible, aborting"); return; } - - [self showView:[self feedbackListViewController:YES]]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self showView:[self feedbackListViewController:YES]]; + }); } @@ -246,9 +247,9 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac } BITFeedbackComposeViewController *composeView = [self feedbackComposeViewController]; [composeView prepareWithItems:items]; - - [self showView:composeView]; - + dispatch_async(dispatch_get_main_queue(), ^{ + [self showView:composeView]; + }); } - (void)showFeedbackComposeViewWithGeneratedScreenshot { diff --git a/Classes/BITHockeyBaseManager.m b/Classes/BITHockeyBaseManager.m index d2dd74aa66..dde6b76727 100644 --- a/Classes/BITHockeyBaseManager.m +++ b/Classes/BITHockeyBaseManager.m @@ -258,7 +258,6 @@ // if we compile Crash only, then BITHockeyBaseViewController is not included // in the headers and will cause a warning with the modulemap file #if HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK - dispatch_async(dispatch_get_main_queue(), ^{ UIViewController *parentViewController = [self visibleWindowRootViewController]; // as per documentation this only works if called from within viewWillAppear: or viewDidAppear: @@ -295,7 +294,6 @@ [(BITHockeyBaseViewController *)viewController setModalAnimated:NO]; [visibleWindow addSubview:_navController.view]; } - }); #endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK */ } #endif // HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions && HOCKEYSDK_CONFIGURATION_RelaseCrashOnlyWatchOS diff --git a/Classes/BITUpdateManager.h b/Classes/BITUpdateManager.h index a8a7b005b5..36747bd82c 100644 --- a/Classes/BITUpdateManager.h +++ b/Classes/BITUpdateManager.h @@ -220,6 +220,8 @@ typedef NS_ENUM (NSUInteger, BITUpdateSetting) { /** Present the modal update user interface. + + @warning Make sure to call this method from the main thread! */ - (void)showUpdateView; diff --git a/Classes/BITUpdateManager.m b/Classes/BITUpdateManager.m index 249d214d27..5425584fde 100644 --- a/Classes/BITUpdateManager.m +++ b/Classes/BITUpdateManager.m @@ -545,7 +545,9 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { if ([self hasNewerMandatoryVersion] || [self expiryDateReached]) { [updateViewController setMandatoryUpdate: YES]; } - [self showView:updateViewController]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self showView:updateViewController]; + }); } From dac40c5e82c8ab65578b52af3842b0d478605361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Tue, 6 Oct 2015 12:20:05 +0200 Subject: [PATCH 14/16] Correct typo in documentation --- Classes/BITCrashManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/BITCrashManager.h b/Classes/BITCrashManager.h index d580643cbf..44345df0bb 100644 --- a/Classes/BITCrashManager.h +++ b/Classes/BITCrashManager.h @@ -225,7 +225,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) { * EXPERIMENTAL: Enable heuristics to detect the app not terminating cleanly * * This allows it to get a crash report if the app got killed while being in the foreground - * because of now of the following reasons: + * because of one of the following reasons: * - The main thread was blocked for too long * - The app took too long to start up * - The app tried to allocate too much memory. If iOS did send a memory warning before killing the app because of this reason, `didReceiveMemoryWarningInLastSession` returns `YES`. From 566d6f77fd0a06ed2706c7d007def169c6d9ba83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Fri, 9 Oct 2015 13:44:45 +0200 Subject: [PATCH 15/16] Disable Bitcode in UI since we set this from xcconfig This should remedy compiler warnings where the compiler complains about both bitcode flags `-fembed-bitcode` and `-fembed-bitcode-marker` being present. --- Support/HockeySDK.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Support/HockeySDK.xcodeproj/project.pbxproj b/Support/HockeySDK.xcodeproj/project.pbxproj index 7b06a211be..8fec26e5f7 100644 --- a/Support/HockeySDK.xcodeproj/project.pbxproj +++ b/Support/HockeySDK.xcodeproj/project.pbxproj @@ -1681,6 +1681,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; DSTROOT = /tmp/HockeySDK.dst; + ENABLE_BITCODE = NO; ENABLE_NS_ASSERTIONS = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1932,6 +1933,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; DSTROOT = /tmp/HockeySDK.dst; + ENABLE_BITCODE = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/../Vendor\"", @@ -1953,6 +1955,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; DSTROOT = /tmp/HockeySDK.dst; + ENABLE_BITCODE = NO; ENABLE_NS_ASSERTIONS = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -2155,6 +2158,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; DSTROOT = /tmp/HockeySDK.dst; + ENABLE_BITCODE = NO; ENABLE_NS_ASSERTIONS = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", From 0bf1bd929c0684708f6c9cf1bfb3e81655803579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Fri, 9 Oct 2015 14:17:37 +0200 Subject: [PATCH 16/16] Update documentation for setting up SDK with extensions --- README.md | 8 ++++---- docs/Guide-Installation-Setup-template.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index fc06ee3371..fc8ec1619e 100644 --- a/README.md +++ b/README.md @@ -212,9 +212,9 @@ The following points need to be considered to use the HockeySDK SDK with iOS Ext 2. You need to make sure the SDK setup code is only invoked **once**. Since there is no `applicationDidFinishLaunching:` equivalent and `viewDidLoad` can run multiple times, you need to use a setup like the following example: ```objectivec - @interface TodayViewController () + static BOOL didSetupHockeySDK = NO; - @property (nonatomic, assign) BOOL didSetupHockeySDK; + @interface TodayViewController () @end @@ -222,10 +222,10 @@ The following points need to be considered to use the HockeySDK SDK with iOS Ext * (void)viewDidLoad { [super viewDidLoad]; - if (!self.didSetupHockeySDK) { + if (!didSetupHockeySDK) { [[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"]; [[BITHockeyManager sharedHockeyManager] startManager]; - self.didSetupHockeySDK = YES; + didSetupHockeySDK = YES; } } ``` diff --git a/docs/Guide-Installation-Setup-template.md b/docs/Guide-Installation-Setup-template.md index 47a17157f5..253156dfc7 100644 --- a/docs/Guide-Installation-Setup-template.md +++ b/docs/Guide-Installation-Setup-template.md @@ -196,9 +196,9 @@ The following points need to be considered to use the HockeySDK SDK with iOS Ext 2. You need to make sure the SDK setup code is only invoked **once**. Since there is no `applicationDidFinishLaunching:` equivalent and `viewDidLoad` can run multiple times, you need to use a setup like the following example: ```objectivec - @interface TodayViewController () + static BOOL didSetupHockeySDK = NO; - @property (nonatomic, assign) BOOL didSetupHockeySDK; + @interface TodayViewController () @end @@ -206,10 +206,10 @@ The following points need to be considered to use the HockeySDK SDK with iOS Ext * (void)viewDidLoad { [super viewDidLoad]; - if (!self.didSetupHockeySDK) { + if (!didSetupHockeySDK) { [[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"]; [[BITHockeyManager sharedHockeyManager] startManager]; - self.didSetupHockeySDK = YES; + didSetupHockeySDK = YES; } } ```