From a76f80c7a0c170f004283a1470adb0d436ff7146 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 7 Sep 2015 16:58:40 +0200 Subject: [PATCH] Wizard: never use == for NSNumber comparaison, it will compare pointers and this is actually broken on iOS 8. Instead use isEqual method --- Classes/ChatRoomTableViewController.m | 7 ++++--- Classes/WizardViewController.m | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Classes/ChatRoomTableViewController.m b/Classes/ChatRoomTableViewController.m index c1dcd3adf..673894539 100644 --- a/Classes/ChatRoomTableViewController.m +++ b/Classes/ChatRoomTableViewController.m @@ -64,9 +64,10 @@ // also append transient upload messages because they are not in history yet! for (FileTransferDelegate *ftd in [[LinphoneManager instance] fileTransferDelegates]) { - if (linphone_chat_room_get_peer_address(linphone_chat_message_get_chat_room(ftd.message)) == - linphone_chat_room_get_peer_address(chatRoom) && - linphone_chat_message_is_outgoing(ftd.message)) { + const LinphoneAddress *ftd_peer = + linphone_chat_room_get_peer_address(linphone_chat_message_get_chat_room(ftd.message)); + const LinphoneAddress *peer = linphone_chat_room_get_peer_address(chatRoom); + if (linphone_address_equal(ftd_peer, peer) && linphone_chat_message_is_outgoing(ftd.message)) { LOGI(@"Appending transient upload message %p", ftd.message); self->messageList = ms_list_append(self->messageList, linphone_chat_message_ref(ftd.message)); } diff --git a/Classes/WizardViewController.m b/Classes/WizardViewController.m index af9e0c5f5..07a6a222c 100644 --- a/Classes/WizardViewController.m +++ b/Classes/WizardViewController.m @@ -944,9 +944,8 @@ static UICompositeViewDescription *compositeDescription = nil; otherButtonTitles:nil, nil]; [errorView show]; } else if ([response object] != nil) { // Don't handle if not object: HTTP/Communication Error - NSString *value = [response object]; if ([[request method] isEqualToString:@"check_account"]) { - if ([value integerValue] == 1) { + if ([response.object isEqualToNumber:[NSNumber numberWithInt:1]]) { UIAlertView *errorView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Check issue", nil) message:NSLocalizedString(@"Username already exists", nil) @@ -962,7 +961,7 @@ static UICompositeViewDescription *compositeDescription = nil; [self createAccount:identity password:password email:email]; } } else if ([[request method] isEqualToString:@"create_account_with_useragent"]) { - if ([value integerValue] == 0) { + if ([response.value isEqualToNumber:[NSNumber numberWithInt:0]]) { NSString *username = [WizardViewController findTextField:ViewElement_Username view:contentView].text; NSString *password = [WizardViewController findTextField:ViewElement_Password view:contentView].text; [self changeView:validateAccountView back:FALSE animation:TRUE]; @@ -978,7 +977,7 @@ static UICompositeViewDescription *compositeDescription = nil; [errorView show]; } } else if ([[request method] isEqualToString:@"check_account_validated"]) { - if ([value integerValue] == 1) { + if ([response.object isEqualToNumber:[NSNumber numberWithInt:1]]) { NSString *username = [WizardViewController findTextField:ViewElement_Username view:contentView].text; NSString *password = [WizardViewController findTextField:ViewElement_Password view:contentView].text; [self addProxyConfig:username password:password domain:nil withTransport:nil];