2012-10-01 12 views
37

में बहिष्कृत किया गया मेरा कोड अपेक्षा के अनुसार काम कर रहा है कि मुझे इस चेतावनी संदेश से छुटकारा पाने की आवश्यकता है। TWTeetComposeViewController IOS6 में बहिष्कृत। Ios6 में इस अंतर्निहित दृश्य नियंत्रक के लिए कोई प्रतिस्थापन?TWTweetComposeViewController IOS6

मेरा नमूना कोड यहां है।

if ([TWTweetComposeViewController canSendTweet]) { 
    // Initialize Tweet Compose View Controller 
    TWTweetComposeViewController *vc = [[TWTweetComposeViewController alloc] init]; 
    // Settin The Initial Text 
    [vc setInitialText:@"This tweet was sent using the new Twitter framework available in iOS 5."]; 
    // Adding an Image 
    UIImage *image = [UIImage imageNamed:@"sample.jpg"]; 
    [vc addImage:image]; 
    // Adding a URL 
    NSURL *url = [NSURL URLWithString:@"http://mobile.tutsplus.com"]; 
    [vc addURL:url]; 
    // Setting a Completing Handler 
    [vc setCompletionHandler:^(TWTweetComposeViewControllerResult result) { 
     [self dismissModalViewControllerAnimated:YES]; 
    }]; 
    // Display Tweet Compose View Controller Modally 
    [self presentViewController:vc animated:YES completion:nil]; 
} else { 
    // Show Alert View When The Application Cannot Send Tweets 
    NSString *message = @"The application cannot send a tweet at the moment. This is because it cannot reach Twitter or you don't have a Twitter account associated with this device."; 
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oops" message:message delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil]; 
    [alertView show]; 
} 
+0

आप कहाँ कि TWTeetComposeViewController देखा था ?? http://developer.apple.com/library/ios/#documentation/Twitter/Reference/TWTweetSheetViewControllerClassRef/Reference/Reference.html – Martin

उत्तर

68

iOS 5 & आईओएस 6
1. पुस्तकालय के बारे में के बीच सामाजिक नेटवर्क का उपयोग कर के साथ कुछ परिवर्तन नहीं कर रहे हैं।
2. हम TWTweetComposeViewController के बजाय SLComposeViewController का उपयोग करते हैं।
3. कृपया निम्न कोड के साथ कुछ एपीआई तुलना:

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) { 

     SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter]; 

     SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){ 
      if (result == SLComposeViewControllerResultCancelled) { 

       NSLog(@"Cancelled"); 

      } else 

      { 
       NSLog(@"Done"); 
      } 

      [controller dismissViewControllerAnimated:YES completion:Nil]; 
     }; 
     controller.completionHandler =myBlock; 

     //Adding the Text to the facebook post value from iOS 
     [controller setInitialText:@"Test Post from mobile.safilsunny.com"]; 

     //Adding the URL to the facebook post value from iOS 

     [controller addURL:[NSURL URLWithString:@"http://www.mobile.safilsunny.com"]]; 

     //Adding the Image to the facebook post value from iOS 

     [controller addImage:[UIImage imageNamed:@"fb.png"]]; 

     [self presentViewController:controller animated:YES completion:Nil]; 

    } 
    else{ 
     NSLog(@"UnAvailable"); 
    } 

बस थोड़ी मतभेद नहीं है, लेकिन वे और अधिक महान कर रहे हैं।

प्राथमिकताएं: - safilsunny सुझाव: http://www.mobile.safilsunny.com/integrating-facebook-ios-6/

धन्यवाद,

27

हाँ, आप आईओएस 6 Social Framework यह फेसबुक एकीकरण अब iOS पर उपस्थित करने के लिए धन्यवाद है का उपयोग करना चाहिए रहे हैं। आप वहां से ट्विटर और फेसबुक का उपयोग करने में सक्षम होंगे। iOS 6 में हम ट्विटर फ्रेमवर्क के बजाय सामाजिक ढांचे का उपयोग:

संबंधित मुद्दे