ios-Social Sharing

Source: Internet
Author: User

First, how to achieve social sharing

In iOS, the way to "social sharing" 1. Write your own shared code for each platform (more code) 2. Take advantage of iOS Social.framework 3. Sharing framework with third parties: http://dev.umeng.com/social/ Ios/share/quick-integrationsharesdk:http://wiki.mob.com/ios Quick Integration Guide Baidu Social sharing component: http://developer.baidu.com/soc/ Share

(Baidu also has a "social login component": Http://developer.baidu.com/soc/login)

Second, social.framework use steps

Determine if a service is available

[Slcomposeviewcontroller Isavailableforservicetype:slservicetypesinaweibo]

Popup Shared Content Input interface

Slcomposeviewcontroller *CC = [Slcomposeviewcontroller Composeviewcontrollerforservicetype:slservicetypesinaweibo] ;

[Self presentviewcontroller:cc animated:yes completion:nil];

Additional settings

[CC setinitialtext:@ "Test text"]; Initialize text

[CC addimage:[uiimage imagenamed:@ "Lufy"]; Image matching

Iii. Introduction to social platforms

1. twitter--Twitter

Started in 2006, there are currently 200 million users Twitter is a popular social network service, allowing users to use their latest news and ideas in the form of short messages in mobile phones (Weibo allows only 140 word origin) to publish the origin of the tweet name, Twitter is a bird cry, The founders believe that Bird calls are short, fast, and consistent with the connotation of the site iOS 5 offers Twitter API iOS 6 to integrate Twitter into Social.framework 2. facebook--is not dead. Facebook is the world's number one photo sharing site, uploading 8.5 million photos a day February 2004 4 launched, as of September 2012, the site has more than a billion of active users, users upload more than more than 219 billion photos is the world's largest social networking site, The founder is a 84-born Zuckerberg, and in 2008 already owns 13.5 billion net worth of Facebook with an application interface (open Interface) The combination of accounts.framework and social.framework in iOS gives you more precise control over the media services in Facebook 3. Linkedin Business customer-oriented social network Service website, founded in December 2002 and launched in 2003 January 2011, LinkedIn has more than 90 million registered users in January 2012, LinkedIn has more than 150 million registered users The goal is for registered users to maintain the contacts they know and trust in their business dealings, known as "People" (Connections). Users can invite people he knows to become a network. Integrate LinkedIn into social.framework in IOS 7

Code:

1 //2 //VIEWCONTROLLER.M3 //ios_0404_ system comes with share4 //5 //Created by Ma C on 16/4/4.6 //copyright©2016 Blog Technology. All rights reserved.7 //8 9 #import "ViewController.h"Ten #import<Social/Social.h> One  A @interfaceViewcontroller () -  - @end the  - @implementationViewcontroller -  -- (void) Viewdidload { + [Super Viewdidload]; -Self.view.backgroundColor =[Uicolor Cyancolor]; + } A  at- (void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *)Event - { -     //1. Determine if the service is available -     if([Slcomposeviewcontroller Isavailableforservicetype:slservicetypesinaweibo]) { -NSLog (@"Share available"); -     } in     //2. Create a sharing controller -Slcomposeviewcontroller *COMPOSEVC =[Slcomposeviewcontroller Composeviewcontrollerforservicetype:slservicetypesinaweibo]; to     //Set default data +[Composevc Setinitialtext:@"hehe haha"]; -[Composevc addimage:[uiimage imagenamed:@""]]; the     //3. Pop-up sharing controller * [self PRESENTVIEWCONTROLLER:COMPOSEVC animated:nil completion:nil]; $     //4. Monitor sharing statusPanax NotoginsengComposevc.completionhandler = ^(slcomposeviewcontrollerresult result) { -          the         if(Result = =slcomposeviewcontrollerresultcancelled) { +NSLog (@"Cancel Send"); A}Else { theNSLog (@"sent successfully"); +         } -          $     }; $  - } -  the @end

ios-Social Sharing

Related Article

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.