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..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,23 +294,26 @@ if(succeeded) { //controller should dismiss us shortly.. } else { - - // 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 @@ -320,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]; + }); } }]; } @@ -334,4 +338,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR */ 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 9cd9d00d7b..6beccedd16 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,11 +165,11 @@ 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!"); } -- (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); @@ -244,39 +246,43 @@ 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 - (void) validate { [self validateWithCompletion:^(BOOL validated, NSError *error) { - if(validated) { - [self dismissAuthenticationControllerAnimated:YES completion:nil]; - } else { - BITHockeyLog(@"Validation failed with error: %@", error); - - // 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 @@ -287,8 +293,9 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; [alertView setTag:0]; [alertView show]; #pragma clang diagnostic pop + /*}*/ } - } + }); }]; } @@ -360,7 +367,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) { @@ -372,7 +379,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]; @@ -380,11 +387,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); @@ -396,7 +403,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; @@ -456,7 +463,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()); @@ -466,7 +473,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) { @@ -493,8 +500,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; @@ -509,9 +516,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 { @@ -522,7 +531,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 ? : @"", @@ -797,7 +806,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); @@ -805,7 +814,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; } buffer = source + 8; - + NSString *result = nil; bit_uint32 length; unsigned char *name; @@ -826,7 +835,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")) { @@ -842,7 +851,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; chunk_index = 128; } } - + free(data); free(name); @@ -873,12 +882,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]; + }]; } } @@ -900,10 +909,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]; @@ -996,4 +1005,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.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`. diff --git a/Classes/BITCrashManager.m b/Classes/BITCrashManager.m index d27fecb407..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,9 +1106,9 @@ static void uncaught_cxx_exception_handler(const BITCrashUncaughtCXXExceptionInf [alertView show]; #pragma clang diagnostic pop - } + /*}*/ } -#endif +#endif /* !defined (HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions) */ } else { [self approveLatestCrashReport]; @@ -1524,7 +1526,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 bfbd0e6449..755686dba4 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) @@ -868,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/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/BITFeedbackListViewCell.m b/Classes/BITFeedbackListViewCell.m index 5f95480ec1..8e543e63be 100644 --- a/Classes/BITFeedbackListViewCell.m +++ b/Classes/BITFeedbackListViewCell.m @@ -370,4 +370,4 @@ @end -#endif +#endif /* HOCKEYSDK_FEATURE_FEEDBACK */ diff --git a/Classes/BITFeedbackListViewController.m b/Classes/BITFeedbackListViewController.m index 67f77db590..5291cd65f1 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.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 d570b99cf8..ecc74cf075 100644 --- a/Classes/BITFeedbackManager.m +++ b/Classes/BITFeedbackManager.m @@ -223,8 +223,9 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); BITHockeyLog(@"INFO: update view already visible, aborting"); return; } - - [self showView:[self feedbackListViewController:YES]]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self showView:[self feedbackListViewController:YES]]; + }); } @@ -249,9 +250,9 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); } BITFeedbackComposeViewController *composeView = [self feedbackComposeViewController]; [composeView prepareWithItems:items]; - - [self showView:composeView]; - + dispatch_async(dispatch_get_main_queue(), ^{ + [self showView:composeView]; + }); } - (void)showFeedbackComposeViewWithGeneratedScreenshot { @@ -802,6 +803,8 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); } if(self.showAlertOnIncomingMessages && !self.currentFeedbackListViewController && !self.currentFeedbackComposeViewController) { + dispatch_async(dispatch_get_main_queue(), ^{ + /* // Requires iOS 8 id uialertcontrollerClass = NSClassFromString(@"UIAlertController"); if (uialertcontrollerClass) { @@ -819,9 +822,10 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); }]; [alertController addAction:cancelAction]; [alertController addAction:showAction]; - - [self showAlertController:alertController]; - } else { + + [self showAlertController:alertController]; + } else { + */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageTitle") @@ -833,8 +837,9 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); [alertView setTag:0]; [alertView show]; #pragma clang diagnostic pop - } - _incomingMessagesAlertShowing = YES; + /*}*/ + _incomingMessagesAlertShowing = YES; + }); } } } @@ -856,7 +861,7 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); } -- (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; @@ -960,22 +965,24 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); }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) { @@ -1034,7 +1041,9 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); } [self markSendInProgressMessagesAsPending]; - completionHandler(err); + if (completionHandler) { + completionHandler(error); + } } } @@ -1048,7 +1057,7 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); [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]; }]; @@ -1069,7 +1078,7 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); 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) @@ -1086,8 +1095,8 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *latestImage); [self sendNetworkRequestWithHTTPMethod:httpMethod withMessage:messageToSend - completionHandler:^(NSError *err){ - if (err) { + completionHandler:^(NSError *error){ + if (error) { [self markSendInProgressMessagesAsPending]; [self saveMessages]; } 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 310107363a..dde6b76727 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 } - +/* 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 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,51 +250,51 @@ if (parentViewController) { [parentViewController presentViewController:alertController animated:YES completion:nil]; } -#endif }); } +*/ - (void)showView:(UIViewController *)viewController { // 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]; + 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]; - } -#endif + _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 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/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 8d6cfef3b5..b28ecde1be 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/BITStoreUpdateManager.m b/Classes/BITStoreUpdateManager.m index dfca526b9a..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]; @@ -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.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 0f52f73b2a..5425584fde 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; } } @@ -543,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]; + }); } @@ -555,6 +559,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 +594,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 +606,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 +659,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 +674,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [alertView setTag:BITUpdateAlertViewTagDefaultUpdate]; [alertView show]; #pragma clang diagnostic pop - } + /*}*/ _updateAlertShowing = YES; } } @@ -741,6 +748,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 +780,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 +796,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { [alertView setTag:BITUpdateAlertViewTagNeverEndingAlertView]; [alertView show]; - } + /*}*/ } #pragma mark - RequestComments @@ -917,6 +926,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 +942,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 +952,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { otherButtonTitles:nil]; [alert show]; #pragma clang diagnostic pop - } + /*}*/ return NO; #else @@ -970,7 +981,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { return success; -#endif +#endif /* TARGET_IPHONE_SIMULATOR */ } @@ -1090,7 +1101,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 +1125,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 +1135,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) { otherButtonTitles:nil]; [alert show]; #pragma clang diagnostic pop - } + /*}*/ } if (self.isUpdateAvailable && (self.alwaysShowUpdateReminder || newVersionDiffersFromCachedVersion || [self hasNewerMandatoryVersion])) { 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 */ diff --git a/README.md b/README.md index fa460991f6..015abf39f4 100644 --- a/README.md +++ b/README.md @@ -214,9 +214,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 @@ -224,10 +224,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/Support/HockeySDK.xcodeproj/project.pbxproj b/Support/HockeySDK.xcodeproj/project.pbxproj index 7ec72ad40b..43c7a41d3a 100644 --- a/Support/HockeySDK.xcodeproj/project.pbxproj +++ b/Support/HockeySDK.xcodeproj/project.pbxproj @@ -2005,6 +2005,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)", @@ -2256,6 +2257,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; DSTROOT = /tmp/HockeySDK.dst; + ENABLE_BITCODE = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/../Vendor\"", @@ -2277,6 +2279,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)", @@ -2479,6 +2482,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)", diff --git a/docs/Guide-Installation-Setup-template.md b/docs/Guide-Installation-Setup-template.md index 0e9d318946..7a3945a363 100644 --- a/docs/Guide-Installation-Setup-template.md +++ b/docs/Guide-Installation-Setup-template.md @@ -190,7 +190,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: @@ -198,9 +198,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 @@ -208,10 +208,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; } } ```