iOS5 - sharekit for twitter issue

后端 未结 2 781
温柔的废话
温柔的废话 2021-02-06 15:03

I am facing keyboard issue in sharekit for iOS5 only.While posting text content to twitter.

\"enter

2条回答
  •  攒了一身酷
    2021-02-06 15:44

    Find Alex Terente's Answer in wiki also.

    Edit1:

    Fix Issue #254 - IOS 5 Cancel Button Fix for issue https://github.com/ideashower/ShareKit/issues/254. In iOS 5, a modally presented view controller has a nil parentViewController, and instead the presenter is presentingViewController. Changed the attempts to dismiss the view using the parentViewController to check for the iOS 5 selector, and used it if available. So get the latest ShareKit.

    Edit 2: I recommend to use TWTweetComposeViewController if the device has iOS 5.

    Class TWTweetComposeViewControllerClass = NSClassFromString(@"TWTweetComposeViewController");
    
         if (TWTweetComposeViewControllerClass != nil) {
              if([TWTweetComposeViewControllerClass respondsToSelector:@selector(canSendTweet)]) {
                  UIViewController *twitterViewController = [[TWTweetComposeViewControllerClass alloc] init];
    
                  [twitterViewController performSelector:@selector(setInitialText:) 
                                              withObject:NSLocalizedString(@"TwitterMessage", @"")];
                  [twitterViewController performSelector:@selector(addURL:) 
                                              withObject:url];
    
                   [twitterViewController performSelector:@selector(addImage:) 
                                               withObject:[UIImage imageNamed:@"yourImage.png"]];
                    [self.navigationController presentModalViewController:twitterViewController animated:YES];
                    [twitterViewController release];
                    }
                } else {
                    [SHK flushOfflineQueue];
                    SHKItem *item = [SHKItem URL:url title:NSLocalizedString(@"TwitterMessage", @"")];
    
                    // Get the ShareKit action sheet
                    SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
    
                    // Display the action sheet
                    [actionSheet showInView:[self.view superview].window];
                }
    

    Add in your h file

    #if defined(__IPHONE_5_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0
    #import 
    #import 
    #endif
    

    And add the Twitter framework and Accounts as optional Libraries.

提交回复
热议问题