ios - How to send In-App SMS in iphone -
Working as M Messenger app I want to send an SMS to its customers as a verification code; and users of the code Can be used as verification code .. can someone send me SMS automatically on my client?
Ex.
If the user clicks on the register at that time, he will automatically receive the confirmation SMS from the iPhone client.
This extension is I do encoding / decoding related questions:
#import & Lt; Foundation / Foundation. H & gt; @ Interface base 64: NSBackstation {} + (zero) initialize; + (NSString *) encode: (const uint8_t *) Input Length: (NSInteger) Length; + (NSString *) Indicator: (NSDT *) Rawbeauts; + (NSDT *) Decode: (Const four *) String length: (NSINTEGAR) Input language; + (NSDT *) Decode: (NSString *) string; @end #import "Base64.h" @implementation Base64 #define ArrayLength (X) (sizeof (x) / sizeof (* (x))) stable four encodingTable [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 + /"; Fixed four decoding tables [128]; + (Zero) start {if (self == [base64 class]) {mametet (decoding tab, 0, array length (decodingtable)); (NSInteger i = 0; i & lt; ArrayLength (encoding tab); i ++) {decodingTable [encodingTable [i]] = i; }}} + (NSString *) encode: (constant Uint8_t *) input length (NSInteger) length {NSMutableData * data = [NSMutableData dataWithLength: ((length + 2) / 3) * 4]; Uint8_t * Output = (uint8_t *) data Mittelbabs; (NSInteger i = 0; i & lt; length; i + = 3) {NSInteger value = 0; (Value for NSInteger j = i; j & lt; (i + 3); j ++) & Lt; = 8; If (j & lt; length) {value | = (0xFF and input [J]); }} NSInteger index = (I / 3) * 4; Output [index + 0] = encoding tab [(value> gt; 18) & amp; 0x3F]; Output [index + 1] = encodingTable [(value> gt; 12) & amp; 0x3F]; Output [index + 2] = (I + 1) & lt; Length? EncodingTable [(value>> 6) & amp; 0x3F]: '='; Output [index + 3] = (i + 2) & lt; Length? EncodingTable [(value> gt; & 0) & amp; 0x3F]: '='; } Return [[[NSString alloc] initWithData: data encoding: NSASCIIStringEncoding] autorelease]; } + (NSString *) encode: (NSData *) rawBytes {return [self-encoded (constant uint8_t *) rawBytes.bytes length: rawBytes.length]; } + (NSData *) decode (constant length of char *) string: (NSInteger) inputLength {if (! (Equivalent to string == null) || (inputLength% 4 = 0)) {return not; } While (Input Lagel & gt; 0 & amp; amp; string [inputLength - 1] == '=') {inputLength--; } NSInteger outputLength = inputLength * 3/4; NSMutableData * Data = [NSMutableData dataWithLength: outputLength]; Uint8_t * Output = Data. Mittelbabs; NSInteger inputpoint = 0; NSInteger outputPoint = 0; While (inputpoint & lt; inputLength) {char i0 = string [inputPoint ++]; Char i1 = string [inputPoint ++]; Char i2 = Inputpoint & lt; Input Length? String [Inputpoint ++]: 'A'; / * 'A' \ 0 * / char i3 = Inputpoint & lt; Input Length? String [Inputpoint ++]: 'A'; Output [outputpoint ++] = (decoding table [i0] LT; outputLength) {output [outputPoint ++] = ((decodingTable [i2] & amp; 0x3) & lt; & lt; 6). DecodingTable [i3]; }} Return data; } + Decode (NSData *): (NSString *) string {return [self decode: [string cStringUsingEncoding: NSASCIIStringEncoding] length: string.length]; } @end Hope this will help you.
Comments
Post a Comment