Objective C and Swift in same Project - -[__NSCFNumber length]: unrecognized selector sent to instance -


i new in swift, have appdelegate file in objective-c , current controller in swift. issue have property in appdelegate user_id contain login user id , token property auth_token.

@property (nonatomic, strong) nsstring * user_id; @property (nonatomic, strong) nsstring * auth_token; 

i want these values on swift controller. have instance of current appdelegate like:

let app_delegate_swift = uiapplication.shared.delegate as! appdelegate  

and when print these value on swift controller like:

print("authtoken - \(app_delegate_swift.auth_token!)") print("user id - \(app_delegate_swift.user_id!)") 

i able value of auth_token, in case of user_id, gives me error like:

terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfnumber length]: unrecognized selector sent instance 0xb000000000036783'

error indicates using nsstring method on nsnumber. please, check if data strings.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -