ios - 'NSInvalidArgumentException', reason: '-[__NSCFString encodeString:]: unrecognized selector sent to instance -


i making encoding nsstring value entered in textfield in ios app.

this code

nsstring *encodedstrr = [mytextfeild.text encodestring:nsutf8stringencoding]; nsstring *encodedurlstrr =      [nsstring stringwithformat:                              @"http://www.damain.com:8080/app/f/query?from=%@",                              encodedstrr]; nsurl *urlr11 = [nsurl urlwithstring: encodedurlstrr]; 

i getting following error,

    2016-04-19 11:45:46.186 factualnote[3137:11303] -[__nscfstring  encodestring:]: unrecognized selector sent instance 0x71c5100 2016-04-19 11:45:46.187 factualnote[3137:11303] *** terminating app due     uncaught exception 'nsinvalidargumentexception', reason: '-  [__nscfstring encodestring:]: unrecognized selector sent instance 0x71c5100' *** first throw call stack: (0x1c93012 0x10d0e7e 0x1d1e4bd 0x1c82bbc 0x1c8294e 0x30ff 0x10e4705     0x182c0 0x18258 0xd9021 0xd957f 0xd86e8 0x47cef 0x47f02 0x25d4a 0x17698 0x1beedf9 0x1beead0 0x1c08bf5 0x1c08962 0x1c39bb6 0x1c38f44 0x1c38e1b 0x1bed7e3 0x1bed668 0x14ffc 0x1eed 0x1e15) 

libc++abi.dylib: terminate called throwing exception

i followed url encode https://madebymany.com/blog/url-encoding-an-nsstring-on-ios.

this file using , import in viewcontroller.m.

desing.h

@interface nsstring (encode)     - (nsstring *)encodestring:(nsstringencoding)encoding; @end 

desing.m

@implementation nsstring (encode)     - (nsstring *)encodestring:(nsstringencoding)encoding     {         return (nsstring *) cfbridgingrelease(cfurlcreatestringbyaddingpercentescapes(null, (cfstringref)self,                                                             null, (cfstringref)@";/?:@&=$+{}<>,",                                                             cfstringconvertnsstringencodingtoencoding(encoding)));     }   @end 

following post answer says, memory problem unrecognized selector sent instance [nscfstring subarraywithrange:].

how come out this.

check if category (desing.m) added target, may reason.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -