I can´t to authenticate in iOS - unrecognized selector sent to instance

+1 vote

Hi,

Please helpme, i can´t to use "userService authenticateUser"

When try to execute this function its generated next exception:

-----------------------------------------------------------------------------------------------------------------

App42Trace: -[App42Service populateSignParams].....IN
App42Trace: UTCTimeStamp=2015-09-11T16:54:41.475Z
App42Trace: -[App42Service populateSignParams].....OUT
App42Trace: -[App42Service populateMetaHeaderParams].....IN
App42Trace: InstallationId=57252f262b036527473e437354e4c474
App42Trace: -[App42Service populateMetaHeaderParams].....OUT
App42Trace: MetaHeaders={
    SDKName = iOS;
    deviceId = 57252f262b036527473e437354e4c474;
}
App42Trace: headerParams={
    SDKName = iOS;
    apiKey = e60380295fd6af383179eefd228c5cd775ea7ebf35f7b66201ce1fe644dce730;
    deviceId = 57252f262b036527473e437354e4c474;
    signature = "hqheNIpfW82z5cCkqjDsgtvISsk%3D";
    timeStamp = "2015-09-11T16:54:41.475Z";
    version = "1.0";
}
App42Trace: queryParams={
}
2015-09-11 11:54:41.506 FlashWay[3540:999745] -[ViewController loginclick:]: unrecognized selector sent to instance 0x15dd0dc30
2015-09-11 11:54:41.508 FlashWay[3540:999745] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController loginclick:]: unrecognized selector sent to instance 0x15dd0dc30'
*** First throw call stack:
(0x18531c22c 0x196c780e4 0x1853232f4 0x1853200a8 0x18522296c 0x189dcd1ec 0x189db62c8 0x189dccb88 0x189dcc814 0x189dc5d50 0x189d98f74 0x18a03a124 0x189d97488 0x1852d3f8c 0x1852d3230 0x1852d12e0 0x1851fcf74 0x18eb076fc 0x189dfed94 0x10001bcac 0x197322a08)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

-----------------------------------------------------------------------------------------------------------------

The code that i am executing is: (the API its already initilized)

UserService *userService = [App42API buildUserService];
    
NSString *userName = _tfUserName.text;
NSString *passwd = _tfPassword.text;
    
[userService authenticateUser:userName password:passwd completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
        if (success) {
            User *user = (User*)responseObj;
            NSLog(@"userName is %@" , user.userName);
            NSLog(@"sessionId is %@" ,  user.sessionId);
            _alert.message = @"Has iniciado sesión!";
            [_alert show];
        } else {
            NSLog(@"Exception is %@",[exception reason]);
            NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
            NSLog(@"App Error Code is %d",[exception appErrorCode]);
            NSLog(@"User Info is %@",[exception userInfo]);
            _alert.message = @"Error %@",[exception reason];
            [_alert show];
        }
}];

The API initialization its ok because the next function work correctly into app:

  • userService createUserWithProfile
  • uploadService uploadFile
  • storageService insertJSONDocument

Thanks for your help

asked Sep 11, 2015 in App42 Cloud API-BaaS by javierpineros (15 points)
I tried to reproduce the error at my end, but it is not crashing. Is it a frequent crash or coming randomly? Can you please share the initialisation code as well? It will help us to debug the problem.
Hi, I'm working in this project also.



Q: Is it a frequent crash or coming randomly?

A:  It happens always



Here is the code:



//

//  ViewController.m
//
//  Created by Javier on 8/09/15.
//  Copyright (c) 2015 Javier Piñeros. All rights reserved.
//

#import "ViewController.h"
#define APP_Key     @"<VALUE>"
#define SECRET_Key  @"<VALUE>"


#define  Backend_DBNAME  @"FWDB"
#define  Backend_Collection_UserProfile @"UserProfile"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    // Se instancia el Alert al inicio y se usa en varios lugares
    _alert = [[UIAlertView alloc] initWithTitle:@"Atención" message:@"Falta llenar campo"delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    
    [App42API initializeWithAPIKey:APP_Key andSecretKey:SECRET_Key];
    [App42API enableApp42Trace:YES];
    [App42API enableEventService:YES];
    [App42API enableAppAliveTracking:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)signUpBtnClick:(id)sender {
    SignUpViewController *signUpVC =
    [self.storyboard instantiateViewControllerWithIdentifier:@"SignUpViewController"];
    [self.navigationController pushViewController:signUpVC animated:YES];
}

- (IBAction)loginBtnClick:(id)sender {
    
    UserService *userService = [App42API buildUserService];
    
//    NSString *userName = _tfUserName.text;
//    NSString *passwd = _tfPassword.text;

    NSString *userName = @"javierpineros@hotmail.com";
    NSString *passwd = @"123456";

    
    
    
    [userService authenticateUser:@"javierpineros@hotmail.com" password:@"123456"completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
        if (success) {
            User *user = (User*)responseObj;
            NSLog(@"userName is %@" , user.userName);
            NSLog(@"sessionId is %@" ,  user.sessionId);
            _alert.message = @"Has iniciado sesión!";
            [_alert show];
        } else {1
            NSLog(@"Exception is %@",[exception reason]);
            NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
            NSLog(@"App Error Code is %d",[exception appErrorCode]);
            NSLog(@"User Info is %@",[exception userInfo]);
            _alert.message = @"Error %@",[exception reason];
            [_alert show];
        }
    }];
    
}

- (IBAction)mapFWBtnClick:(id)sender {
    MapFWViewController *mapFWVC =
    [self.storyboard instantiateViewControllerWithIdentifier:@"MapFWViewController"];
    [self.navigationController pushViewController:mapFWVC animated:YES];
}


@end

1 Answer

0 votes

Hello Javier,

I have put some more logs in the SDK which can be downloaded from here. Can you please download the SDK and try? Please share the logs which you get when the issue occurs. It will help to debug the problem.

Thanks.

answered Sep 12, 2015 by rajeev.etc (1,660 points)
Hi thanks, here is the result log:


2015-09-13 00:53:00.898 FlashWay[1836:1201866] You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
2015-09-13 00:53:00.906 FlashWay[1836:1201866] SDK Version : 3.4
App42Trace: APP42_APPSTATETRACKING_ENABLED = 0
App42Trace: APP42_APPALIVETRACK_ENABLED = 1
2015-09-13 00:53:00.908 FlashWay[1836:1201866] AppAlive Enabled
2015-09-13 00:53:00.914 FlashWay[1836:1202015] app42RequestCounter=0...counter=1
2015-09-13 00:53:00.916 FlashWay[1836:1202015] app42RequestCounter=1..
App42Trace: -[App42Service populateSignParams].....IN
App42Trace: -[App42Service populateSignParams].....apiKey= e60380295fd6af383179eefd228c5cd775ea7ebf35f7b66201ce1fe644dce730   appVersion = 1.0
App42Trace: -[App42Service populateSignParams].....SessionId= (null)
2015-09-13 00:53:00.923 FlashWay[1836:1202015] -[App42Service populateSignParams]
2015-09-13 00:53:00.925 FlashWay[1836:1202015] -[App42Service populateSignParams].....userSessionId=
App42Trace: -[App42Service populateSignParams].....SessionId= (null)
App42Trace: -[App42Service populateSignParams].....adminKey= (null)
App42Trace: UTCTimeStamp=2015-09-13T5:53:00,973 a.m.Z
App42Trace: -[App42Service populateSignParams].....getFbAccesToken=
App42Trace: -[App42Service populateSignParams].....fbAccessToken= (null)
App42Trace: -[App42Service populateSignParams].....OUT
App42Trace: -[App42Service populateMetaHeaderParams].....IN
App42Trace: InstallationId=e1e995db1ed60a16f9b60b37c9cc671d
App42Trace: -[App42Service populateMetaHeaderParams].....OUT
App42Trace: MetaHeaders={
    SDKName = iOS;
    deviceId = e1e995db1ed60a16f9b60b37c9cc671d;
}
App42Trace: Carrier Name: TIGO
App42Trace: SignParams = {
    apiKey = e60380295fd6af383179eefd228c5cd775ea7ebf35f7b66201ce1fe644dce730;
    body = "{\"app42\":{\"event\":{\"eventName\":\"INSTALL\",\"app42_lastCommunicatedAt\":\"\",\"app42_userUpdatedOn\":\"\",\"userProperties\":\"\",\"superProperties\":{\"app42_counter\":1,\"app42_os\":\"iPhone OS\",\"app42_installAt\":\"\",\"app42_lastCommunicatedAt\":\"\",\"app42_lib_version\":\"1.0\",\"app42_app_version\":\"1\",\"app42_carrier\":\"TIGO\",\"app42_screen_width\":320,\"app42_model\":\"iPhone\",\"app42_os_version\":\"8.4\",\"app42_screen_height\":568}}}}";
    timeStamp = "2015-09-13T5:53:00,973 a.m.Z";
    version = "1.0";
}
2015-09-13 00:53:01.189 FlashWay[1836:1201866] SDK Version : 3.4
2015-09-13 00:53:01.189 FlashWay[1836:1202016] app42RequestCounter=1...counter=1
2015-09-13 00:53:01.195 FlashWay[1836:1202016] app42RequestCounter=2..
App42Trace: -[App42Service populateSignParams].....IN
App42Trace: -[App42Service populateSignParams].....apiKey= e60380295fd6af383179eefd228c5cd775ea7ebf35f7b66201ce1fe644dce730   appVersion = 1.0
App42Trace: -[App42Service populateSignParams].....SessionId= (null)
2015-09-13 00:53:01.200 FlashWay[1836:1202016] -[App42Service populateSignParams]
2015-09-13 00:53:01.206 FlashWay[1836:1202016] -[App42Service populateSignParams].....userSessionId=
App42Trace: -[App42Service populateSignParams].....SessionId= (null)
App42Trace: -[App42Service populateSignParams].....adminKey= (null)
App42Trace: UTCTimeStamp=2015-09-13T5:53:01,210 a.m.Z
App42Trace: -[App42Service populateSignParams].....getFbAccesToken=
App42Trace: -[App42Service populateSignParams].....fbAccessToken= (null)
App42Trace: -[App42Service populateSignParams].....OUT
App42Trace: -[App42Service populateMetaHeaderParams].....IN
App42Trace: urlString=https://analytics.shephertz.com/cloud/1.0/event?
App42Trace: headerParams={
    SDKName = iOS;
    apiKey = e60380295fd6af383179eefd228c5cd775ea7ebf35f7b66201ce1fe644dce730;
    deviceId = e1e995db1ed60a16f9b60b37c9cc671d;
    signature = "MGQUd%2FGKq%2BSszpVmLU95xM2%2BrKg%3D";
    timeStamp = "2015-09-13T5:53:00,973 a.m.Z";
    version = "1.0";
}
App42Trace: queryParams={
}
App42Trace: InstallationId=e1e995db1ed60a16f9b60b37c9cc671d
App42Trace: -[App42Service populateMetaHeaderParams].....OUT
App42Trace: MetaHeaders={
    SDKName = iOS;
    deviceId = e1e995db1ed60a16f9b60b37c9cc671d;
}
App42Trace: APP42_APPSTATETRACKING_ENABLED = 0
App42Trace: Carrier Name: TIGO
App42Trace: SignParams = {
    apiKey = e60380295fd6af383179eefd228c5cd775ea7ebf35f7b66201ce1fe644dce730;
    body = "{\"app42\":{\"event\":{\"eventName\":\"INSTALL\",\"app42_lastCommunicatedAt\":\"\",\"app42_userUpdatedOn\":\"\",\"userProperties\":\"\",\"superProperties\":{\"app42_counter\":2,\"app42_os\":\"iPhone OS\",\"app42_installAt\":\"\",\"app42_lastCommunicatedAt\":\"\",\"app42_lib_version\":\"1.0\",\"app42_app_version\":\"1\",\"app42_carrier\":\"TIGO\",\"app42_screen_width\":320,\"app42_model\":\"iPhone\",\"app42_os_version\":\"8.4\",\"app42_screen_height\":568}}}}";
    timeStamp = "2015-09-13T5:53:01,210 a.m.Z";
    version = "1.0";
}
App42Trace: urlString=https://analytics.shephertz.com/cloud/1.0/event?
App42Trace: headerParams={
    SDKName = iOS;
    apiKey = e60380295fd6af383179eefd228c5cd775ea7ebf35f7b66201ce1fe644dce730;
    deviceId = e1e995db1ed60a16f9b60b37c9cc671d;
    signature = "Ek5dBIhd2R05P5IgdgQJq7Z2NN4%3D";
    timeStamp = "2015-09-13T5:53:01,210 a.m.Z";
    version = "1.0";
}
App42Trace: queryParams={
}
App42Trace: __64-[Connector handleAsyncResponse:withData:error:completionBlock:]_block_invoke..error=Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0x1658c060 {NSErrorFailingURLKey=https://analytics.shephertz.com/cloud/1.0/event?, NSErrorFailingURLStringKey=https://analytics.shephertz.com/cloud/1.0/event?, NSUnderlyingError=0x1667cb10 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)"}
App42Trace: __64-[Connector handleAsyncResponse:withData:error:completionBlock:]_block_invoke..responseDict={
    app42Fault =     {
        appErrorCode = 1401;
        details = "Client is not authorized";
        httpErrorCode = 401;
        message = "UnAuthorized Access";
    };
}
2015-09-13 00:53:02.627 FlashWay[1836:1201866] Exception = {"app42Fault":{"httpErrorCode":401,"appErrorCode":1401,"message":"UnAuthorized Access","details":"Client is not authorized"}}
App42Trace: -[App42Service populateSignParams].....IN
App42Trace: -[App42Service populateSignParams].....apiKey= e60380295fd6af383179eefd228c5cd775ea7ebf35f7b66201ce1fe644dce730   appVersion = 1.0
App42Trace: -[App42Service populateSignParams].....SessionId= (null)
2015-09-13 00:53:27.375 FlashWay[1836:1201866] -[App42Service populateSignParams]
2015-09-13 00:53:27.376 FlashWay[1836:1201866] -[App42Service populateSignParams].....userSessionId=
App42Trace: -[App42Service populateSignParams].....SessionId= (null)
App42Trace: -[App42Service populateSignParams].....adminKey= (null)
App42Trace: UTCTimeStamp=2015-09-13T5:53:27,377 a.m.Z
App42Trace: -[App42Service populateSignParams].....getFbAccesToken=
App42Trace: -[App42Service populateSignParams].....fbAccessToken= (null)
App42Trace: -[App42Service populateSignParams].....OUT
App42Trace: -[App42Service populateMetaHeaderParams].....IN
App42Trace: InstallationId=e1e995db1ed60a16f9b60b37c9cc671d
App42Trace: -[App42Service populateMetaHeaderParams].....OUT
App42Trace: MetaHeaders={
    SDKName = iOS;
    deviceId = e1e995db1ed60a16f9b60b37c9cc671d;
}
App42Trace: urlString=https://api.shephertz.com/cloud/1.0/user/authenticate?
App42Trace: headerParams={
    SDKName = iOS;
    apiKey = e60380295fd6af383179eefd228c5cd775ea7ebf35f7b66201ce1fe644dce730;
    deviceId = e1e995db1ed60a16f9b60b37c9cc671d;
    signature = "BRqcNPp%2FiyPqsG1v%2B%2BQlKYYijMg%3D";
    timeStamp = "2015-09-13T5:53:27,377 a.m.Z";
    version = "1.0";
}
App42Trace: queryParams={
}
2015-09-13 00:53:27.383 FlashWay[1836:1201866] -[ViewController loginclick:]: unrecognized selector sent to instance 0x16563050
Hello Javier,
Can you please share the device details which you are using to test? Also, if possible, can you share the sample project in which this issue is coming on support@shephertz.com. It will help us to debug the problem.
Thanks.
Hi,

It seems to any iOS device, including iPhone 5 and iPad 2

I sent an email with the full project.


Best,
I did check the project you shared and i found that the crash is due to two IBActions assigned to the login button. Also out of two actions one called loginClick does not exist and hence you are getting below exception:

2015-09-13 00:53:27.383 FlashWay[1836:1201866] -[ViewController loginclick:]: unrecognized selector sent to instance 0x16563050

Remove loginClick action from your storyboard and you are good to go.
Let me know if problem continues.
hi,

Thanks for your support. I fix storyboard according to you instructions.

The issue its solved.

Newly Thanks!

Bye.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...