SINVerification Class Reference

Inherits from NSObject
Declared in SINVerification.h

Overview

The SINVerification is the entry point of the Sinch Verification SDK.

Example

 NSError *error = nil;
 idSINPhoneNumber phoneNumber = [SINPhoneNumberUtil() parse:@"415 555 0101"
                                              defaultRegion:@"US"
                                                      error:&error];

 NSString* phoneNumberE164 = [SINPhoneNumberUtil() formatNumber:phoneNumber
                                                         format:SINPhoneNumberFormatE164];

 id<SINVerification> verification = [SINVerification SMSVerificationWithApplicationKey:@"<APPKEY>"
                                                                          phoneNumber:phoneNumberE164];

 [self.verification initiateWithCompletionHandler:^(idSINInitiationResult result, NSError *error) {
   // verification initiated, user will now receive an SMS to their phone.
 }];

 NSString* code; // get user to input code received in SMS

 [self.verification verifyCode:(NSString*) code completionHandler:^(BOOL success, NSError *error) {
   // verification completed
 }];

+ SMSVerificationWithApplicationKey:phoneNumber:

Instantiate a new SMS-based verification.

+ (id<SINVerification>)SMSVerificationWithApplicationKey:(NSString *)applicationKey phoneNumber:(NSString *)phoneNumber

Parameters

applicationKey

Application key identifying the application.

phoneNumber

The phone number to verify. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164)) and should be prefixed with a ‘+’. E.g. to call the US phone number 415 555 0101, it should be specified as “+14155550101”, where the ‘+’ is the required prefix and the US country code ‘1’ added before the local subscriber number.

Return Value

A new SMS-based SINVerification instance.

See Also

Declared In

SINVerification.h

+ SMSVerificationWithApplicationKey:phoneNumber:languages:

Instantiate a new SMS-based verification.

+ (id<SINVerification>)SMSVerificationWithApplicationKey:(NSString *)applicationKey phoneNumber:(NSString *)phoneNumber languages:(NSArray<NSString*> *)languageTags

Parameters

applicationKey

Application key identifying the application.

phoneNumber

The phone number to verify. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164)) and should be prefixed with a ‘+’. E.g. to call the US phone number 415 555 0101, it should be specified as “+14155550101”, where the ‘+’ is the required prefix and the US country code ‘1’ added before the local subscriber number.

languageTags

The preferred content language for SMS verification. It is specified via a list of IETF language tags in order of priority. If the first language is not available, the next one will be selected and so forth. The default is ‘en-US’.

Return Value

A new SMS-based SINVerification instance.

See Also

Declared In

SINVerification.h

+ SMSVerificationWithApplicationKey:phoneNumber:custom:

Instantiate a new SMS-based verification.

+ (id<SINVerification>)SMSVerificationWithApplicationKey:(NSString *)applicationKey phoneNumber:(NSString *)phoneNumber custom:(NSString *)custom

Parameters

applicationKey

Application key identifying the application.

phoneNumber

The phone number to verify. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164)) and should be prefixed with a ‘+’. E.g. to call the US phone number 415 555 0101, it should be specified as “+14155550101”, where the ‘+’ is the required prefix and the US country code ‘1’ added before the local subscriber number.

custom

Application-specific custom data that will be passed to REST API callbacks made to the application’s backend. This custom data will also be written to CDRs (Call Detail Records). (If complex data is to be passed along, it must first be encoded as a NSString*, e.g. encoded as JSON or Base64.)

Return Value

A new SMS-based SINVerification instance.

See Also

Declared In

SINVerification.h

+ SMSVerificationWithApplicationKey:phoneNumber:custom:languages:

Instantiate a new SMS-based verification.

+ (id<SINVerification>)SMSVerificationWithApplicationKey:(NSString *)applicationKey phoneNumber:(NSString *)phoneNumber custom:(NSString *)custom languages:(NSArray<NSString*> *)languageTags

Parameters

applicationKey

Application key identifying the application.

phoneNumber

The phone number to verify. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164)) and should be prefixed with a ‘+’. E.g. to call the US phone number 415 555 0101, it should be specified as “+14155550101”, where the ‘+’ is the required prefix and the US country code ‘1’ added before the local subscriber number.

custom

Application-specific custom data that will be passed to REST API callbacks made to the application’s backend. This custom data will also be written to CDRs (Call Detail Records). (If complex data is to be passed along, it must first be encoded as a NSString*, e.g. encoded as JSON or Base64.)

languageTags

The preferred content language for SMS verification. It is specified via a list of IETF language tags in order of priority. If the first language is not available, the next one will be selected and so forth. The default is ‘en-US’.

Return Value

A new SMS-based SINVerification instance.

See Also

Declared In

SINVerification.h

+ calloutVerificationWithApplicationKey:phoneNumber:

Instantiate a new Callout-based verification. The Sinch backend will call out to the given phone number to verify the phone number.

+ (id<SINVerification>)calloutVerificationWithApplicationKey:(NSString *)applicationKey phoneNumber:(NSString *)phoneNumber

Parameters

applicationKey

Application key identifying the application.

phoneNumber

The phone number to verify. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164)) and should be prefixed with a ‘+’. E.g. to call the US phone number 415 555 0101, it should be specified as “+14155550101”, where the ‘+’ is the required prefix and the US country code ‘1’ added before the local subscriber number.

Return Value

A new Callout-based SINVerification instance.

See Also

Declared In

SINVerification.h

+ calloutVerificationWithApplicationKey:phoneNumber:custom:

Instantiate a new Callout-based verification. The Sinch backend will call out to the given phone number to verify the phone number.

+ (id<SINVerification>)calloutVerificationWithApplicationKey:(NSString *)applicationKey phoneNumber:(NSString *)phoneNumber custom:(NSString *)custom

Parameters

applicationKey

Application key identifying the application.

phoneNumber

The phone number to verify. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164)) and should be prefixed with a ‘+’. E.g. to call the US phone number 415 555 0101, it should be specified as “+14155550101”, where the ‘+’ is the required prefix and the US country code ‘1’ added before the local subscriber number.

custom

Application-specific custom data that will be passed to REST API callbacks made to the application’s backend. This custom data will also be written to CDRs (Call Detail Records). (If complex data is to be passed along, it must first be encoded as a NSString*, e.g. encoded as JSON or Base64.)

Return Value

A new Callout-based SINVerification instance.

See Also

Declared In

SINVerification.h

+ version

Returns the Sinch Verification SDK version.

+ (NSString *)version

Declared In

SINVerification.h

+ setLogCallback:

Set a log callback block.

+ (void)setLogCallback:(__nullable SINLogCallback)block

Parameters

block

log callback block. IMPORTANT: The block may be invoked on any thread / GCD queue.

Discussion

The Sinch Verification SDK will emit all it’s logging by invoking the specified block.

Declared In

SINVerification.h