Introduction Directory:
1. Third party sharing
2. SMS Verification Code
1. Third party sharing
In fact, now there are a lot of third-party sharing tools, today to introduce a more useful sharing tools
mob-Third party sharing
1. Download Sdkhttp://sharesdk.mob.com/#/downloaddetail/sharesdk/ios
2. Import the downloaded framework into the project
3. Get Appkey (third-party framework's Appkey)
4. Adding dependent libraries
(1) All must be added
Libicucore.dylib
Libz.dylib
Libstdc++.dylib
Javascriptcore.framework
(2) Sina Weibo SDK Dependency Library
Imageio.framework
Libsqlite3.dylib
(3) QQ friends and QQ Space SDK dependent library
Libsqlite3.dylib
(4) SDK dependent libraries
Libsqlite3.dylib
(5) SMS and mail need to rely on the library
Messageui.framework
5. In target-userinfo-search Bitcode set Bitcode to No
6. Add URL schemes-> in Info->url Types. QQ Weibo ... The Appkey
7. Add Lsapplicationqueriesschemes array in Info.plist, add the share taken requesting (Weixin) you want to add
8.info.plist->app Transport Security settings->allow arbitrary loads Yes
9. Initialize the corresponding third party social platform
10. Sample Code
////VIEWCONTROLLER.M//SHARESDK Share////Created by Bruce on 16/3/23.//copyright©2016 years, Bruce. All rights reserved.//#import "ViewController.h"#import<ShareSDK/ShareSDK.h>#import<ShareSDKConnector/ShareSDKConnector.h>#import<TencentOpenAPI/TencentOAuth.h>#import<TencentOpenAPI/QQApiInterface.h>#import "WXApi.h"#import "WeiboSDK.h"#import<ShareSDKUI/ShareSDKUI.h>@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; UIButton*button =[UIButton Buttonwithtype:uibuttontypecustom]; Button.frame= CGRectMake ( -, -, -, -); [Button Settitle:@"TICK"Forstate:uicontrolstatenormal]; Button.backgroundcolor=[Uicolor Browncolor]; [Button addtarget:self action: @selector (Share) forcontrolevents:uicontroleventtouchupinside]; [Self.view Addsubview:button];}- (void) sharetomessage{}- (void) share{/** * Set SHARESDK Appkey, if not already registered in the SHARESDK website app, please move to the Http://mob.com/login login background for application registration * in the generated appkey into this method. * The second third parameter in the method is triggered when the social Platform SDK needs to be connected, * The connection code is written in this event. The fourth parameter is triggered when a local social platform is configured, and platform information is configured based on the type of platform returned. * If you are using the server-side hosted platform information, the second to fourth parameter can pass in nil, and the third parameter determines the social SDK to connect based on the server-side hosting platform. */[sharesdk Registerapp:@"9111AC801DFD"activeplatforms:@[@ (ssdkplatformtypewechat)] Onimport:^(Ssdkplatformtype platformtype) {Switch(platformtype) { Casessdkplatformtypewechat: [Sharesdkconnector connectwechat:[wxapiclass]]; Break; default: Break; }} onconfiguration:^ (Ssdkplatformtype platformtype, Nsmutabledictionary *appInfo) { Switch(platformtype) { Casessdkplatformtypewechat: [appInfo ssdksetupwechatbyappid:@"wx72b5127c27ac3f37"Appsecret:@"Affa7858a98a36bfddfb57f8a1f753ad"]; Break; default: Break; } }]; //1. Create Share Parametersnsarray* Imagearray = @[[uiimage imagenamed:@"res2.jpg"]]; //(Note: The image must be in the left directory of Xcode, the name must be transmitted correctly, if you want to share the network image, you can pass iamge parameter images:@[@ "http://mob.com/Assets/images/logo.png?v=20150320"]) if(imagearray) {nsmutabledictionary*shareparams =[Nsmutabledictionary dictionary]; [Shareparams Ssdksetupshareparamsbytext:@"Test your shared content"Images:imagearray Url:[nsurl Urlwi Thstring:@"http://mob.com"] Title:@"Test Title"Type:ssdkcontenttypeauto]; //2. Share (can pop up our share menu and edit interface)[Sharesdk Showshareactionsheet:nil//to display the menu view, this parameter in the ipad version as the reference view of the pop-up menu, only this can pop up our share menu, you can share the button object or create a small view object, the iphone can pass nil does not affectItems:nil Shareparams:shareparams Onshare StateChanged:^ (ssdkresponsestate state, Ssdkplatformtype Platformtype, Nsdictionary *userdata, Ssdkcontententity *contentEntity, Nserror *error, BOOL end) { Switch(state) { Casessdkresponsestatesuccess: {uialertview*alertview = [[Uialertview alloc] Initwithtitle:@"Share Success"Message:nil Delegate: nil Cancelbuttontitle:@"Determine"Otherbuttontitles:nil]; [Alertview show]; Break; } Casessdkresponsestatefail: {uialertview*alert = [[Uialertview alloc] Initwithtitle:@"Sharing Failure"message:[nsstring Stringwithformat:@"%@", Error]Delegate: nil Cancelbuttontitle:@"OK"Otherbuttontitles:nil, nil]; [Alert show]; NSLog (@">>>>>>:%@", error); Break; } default: Break; } } ]; } }- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}@end
Note: 1. If your share is unsuccessful, please check your previous steps to configure the settings well;;;
2. With the real machine to run, because your simulator above can not, nor QQ,
2. SMS Verification Code,
This is going to be a little easier than sharing.
Let's start by creating a few controls
////ViewController.h//Mob SMS Verification////Created by Bruce on 16/3/25.//copyright©2016 years, Bruce. All rights reserved.//#import<UIKit/UIKit.h>@interfaceViewcontroller:uiviewcontroller@property (Strong, nonatomic) Iboutlet Uitextfield*Codetextfield;-(Ibaction) Send: (ID) sender;-(Ibaction) Done: (ID) sender;-(Ibaction) Hiddenkeyboard: (ID) sender;@end
Here is the implementation file:
////VIEWCONTROLLER.M//Mob SMS Verification////Created by Bruce on 16/3/25.//copyright©2016 years, Bruce. All rights reserved.//#import "ViewController.h"#import<SMS_SDK/SMSSDK.h>@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; }- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}-(Ibaction) Send: (IDSender {[smssdk getverificationcodebymethod:smsgetcodemethodsms PhoneNumber:@"13370116152"Zone@" the"Customidentifier:nil result:^ (Nserror *error) {NSLog (@"%@", error); }]; }-(Ibaction) Done: (IDSender {[smssdk commitVerificationCode:self.codeTextField.text PhoneNumber:@"13370116152"Zone@" the"result:^ (Nserror *error) { if(!error) {NSLog (@"Validation Successful"); } Else{NSLog (@"error message:%@", error); } }];}-(Ibaction) Hiddenkeyboard: (IDSender {[Self.codetextfield resignfirstresponder];}@end
Note that there must be a real machine in case the simulator can not have a SIM card ...
mob-third party sharing/mobile Verification code