Social sharing and inter-app jumps

Source: Internet
Author: User

#pragma mark-three. Social sharing
˜
#pragma Mark 1. Bring your own share
1. Determine if the service type is available
2. Create a sharing controller-set text/images/URLs
3. Modal View Popup

#pragma Mark 2. Friend League Share
1. Integration by document

#pragma Mark 3. SSO licensing-The phone has a third-party application installed to enable this feature
SSO refers to single sign-on, when the user installs the corresponding third-party client and login, you can not enter the account password during login process
I. OAUTH2.0 and SSO authorization process differences
OAuth2.0: Load a Web page in the current program--Enter your account password--click Authorize--to share
SSO: Will jump to the corresponding third-party program-click Authorize-To share

The large platform generally supports SSO authorization because it uses more people. Other small and medium-sized platforms, generally only OAuth2.0 authorized

Two. Benefits of SSO Licensing:
1. Easy-to-account password not input--password too long, input error, forgotten password
2. Protect information security--prevent phone numbers or common password leaks 3. Avoid user churn at any point-product manager likes three. Application Scenarios
1. Share
2. Third-party login-the user data should be registered as a user, and then the user data is saved on the server
Third-party login is mainly used to simplify the user login process, through the user-owned Weibo, QQ, and other third-party accounts to log in and build the app's own login account system. 1. Determine if the service type is available
if (![ Slcomposeviewcontroller Isavailableforservicetype:slservicetypesinaweibo]) {
NSLog (@ "has not configured the account, need to add account to the settings");
Return
};

2. Create a share controller
Slcomposeviewcontroller *COMPOSEVC = [Slcomposeviewcontroller composeviewcontrollerforservicetype: Slservicetypesinaweibo];

2.1 Writings
[Composevc setinitialtext:@ "There are 10 kinds of people in the world, one is to understand the binary system, one is not understand the binary system"];

2.2 pic
[Composevc addimage:[uiimage imagenamed:@ "Danshengou"];

2.3 Website
[Composevc addurl:[nsurl urlwithstring:@ "https://www.baidu.com"];

3. Modal View popup [self PRESENTVIEWCONTROLLER:COMPOSEVC animated:yes completion:nil]; Friend League ShareSocial sharing-SDK integration and downloads-latest version of Apple--View demo-> social Sharing-click Detect to determine if the client is installed

1. In the. m file into the header file: #import "WXApi.h"

2, call whether to install the method iswxappinstalled:

if ([Wxapi iswxappinstalled]) {

NSLog (@ "Installed");

And so on other (PS: The Wxapi here is written directly, not the object created by Wxapi or something)add to my product--submit and get AppkeySSO licensing #pragma mark tap the screen to share
-(void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *) event
{
How to make the bottom corner of the program appear as your application name, and then click to jump to your own URL

1. Need to register the developer with the corresponding third-party platform and submit the application review
2. After the successful audit, you should come to the backstage of Friends League (find your own program, the list on the left--social sharing----and fill in the corresponding information)


Note: Share to friends, Friends Circle, collection, QQ space, QQ friends, friends, friends Circle, easy friends, easy friends Circle, Facebook, Twitter, Instagram and other platforms need to refer to their respective integration methods
[Umsocialsnsservice presentsnsiconsheetview:self
appkey:@ "563b01e867e58ef979001f0f"
sharetext:@, I used your account, I was wrong.
Shareimage:[uiimage imagenamed:@ "Icon.png"]
Sharetosnsnames:[nsarray Arraywithobjects:umsharetosina,umsharetowechatsession,umsharetoqq,umsharetodouban, Umsharetoemail, Umsharetofacebook,nil]
Delegate:nil];} #pragma mark analog Sina Weibo login button
-(Ibaction) Loginclick: (ID) Sender {
Umsocialsnsplatform *snsplatform = [Umsocialsnsplatformmanager Getsocialplatformwithname:umsharetosina];

Snsplatform.loginclickhandler (Self,[umsocialcontrollerservice defaultcontrollerservice],yes,^ ( Umsocialresponseentity *response) {

Access to Weibo usernames, uid, tokens, etc.

if (Response.responsecode = = umsresponsecodesuccess) {

umsocialaccountentity *snsaccount = [[Umsocialaccountmanager socialaccountdictionary] ValueForKey:UMShareToSina];

NSLog (@ "username is%@, UID was%@, token is%@ URL is%@", Snsaccount.username,snsaccount.usid,snsaccount.accesstoken,snsa Ccount.iconurl);

You can call your server's registration interface here and register the acquired information as a new user.

}});
}


#pragma mark third-party login successful, you can obtain the user's trust information
-(Ibaction) Ongetuserdataclick: (ID) Sender {
Get Accestoken and Sina user information, the data property of the callback block object parameter Respone
[[Umsocialdataservice Defaultdataservice] Requestsnsinformation:umsharetosina completion:^ (UMSocialResponseEntity *response) {
NSLog (@ "Snsinformation is%@", response.data);
}];} Third-party account application and binding #pragma mark four. Application-to-room jumps
#pragma Mark 1. Normal jump (a apply jump B application) IOS9 has changed
1. Openurl/canopenurl method Jump, add a bullet box, prompting the user, to jump to which program
2. Canopenurl method, increase the limit, need to write the trust whitelist Lsapplicationqueriesschemes Array in advance, add the key value. You can add up to 50 white listsinfo->  #pragma mark clicks the screen to jump to
-(void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *) event
{
IOS9 New Changes
/**
1. Openurl/canopenurl method Jump, add a bullet box, prompting the user, to jump to which program
2. Canopenurl method, increase the limit, need to write the trust whitelist Lsapplicationqueriesschemes Array in advance, add the key value. You can add up to 50 white lists
*/

/**
Url
Protocol Header:/HTTP https://ftp://file://
Path: www.itcast.cn
*/


06-News Want to open "07-" Here root is not a program

Standard notation: First to determine whether to open, if you can jump
if ([[[UIApplication sharedapplication] canopenurl:[nsurl urlwithstring:@ "weixin://"]]) {
[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "weixin://1234"];
}} #pragma mark 2. Jump to the specified page (a apply jump B applies the specified page)
1. A news program to splice different URLs
2. In the program, implement the OpenURL method, then determine whether to include a custom string, and then handle the jump to which interface-(BOOL) Application: (UIApplication *) app OpenURL: (nsurl *) URL Options: (nsdictionary<nsstring*, id> *) options Ns_available_ios (9_0)
{
Contains the specified keyword URL string and jumps to the specified interface

1. Get the root controller--nav
Uinavigationcontroller *nav = (Uinavigationcontroller *) [uiapplication sharedapplication]. Keywindow.rootviewcontroller;
2. Get the host controller
Uiviewcontroller *MAINVC = nav.childviewcontrollers[0];
3. Back to the root controller
[Nav Poptorootviewcontrolleranimated:yes];

4. Jump based on a string
if ([url.absolutestring containsstring:@ "Session"]) {
Jump to Friends List

[MAINVC performseguewithidentifier:@ "session" Sender:nil];

} else if ([url.absolutestring containsstring:@ "Timeline"]) {

[MAINVC performseguewithidentifier:@ "timeline" sender:nil];
}


return YES;} #pragma Mark 3. Applications jump to each other (a apply Jump B app, then jump a app) 1. To loop a jump, you cannot use the Canopenurl method reason: IOS 9 introduces a new feature, Uistackview new control: Uistackview stack view, similar to the AppleWatch group parent class: UIView Features:
    1. Can only be hashed vertically or horizontally, so it cannot completely replace AutoLayout
    2. Ability to quickly get to child controls in order
    3. Bulk modification Spacing accelerates
    4. Batch modification is faster for it
Internal controls do not need to be constrained, only the outermost stackview need to constrain the scenario 1. Horizontal-label/custom TABAR2. Vertical-Settings menu

Social sharing and inter-app jumps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.