<bdo id='anIoi'></bdo><ul id='anIoi'></ul>

      <small id='anIoi'></small><noframes id='anIoi'>

    1. <legend id='anIoi'><style id='anIoi'><dir id='anIoi'><q id='anIoi'></q></dir></style></legend>

      <tfoot id='anIoi'></tfoot>
      <i id='anIoi'><tr id='anIoi'><dt id='anIoi'><q id='anIoi'><span id='anIoi'><b id='anIoi'><form id='anIoi'><ins id='anIoi'></ins><ul id='anIoi'></ul><sub id='anIoi'></sub></form><legend id='anIoi'></legend><bdo id='anIoi'><pre id='anIoi'><center id='anIoi'></center></pre></bdo></b><th id='anIoi'></th></span></q></dt></tr></i><div id='anIoi'><tfoot id='anIoi'></tfoot><dl id='anIoi'><fieldset id='anIoi'></fieldset></dl></div>

        从 ACAccountStore 打开 Twitter 设置 (iOS 5.1 TWITTER)

        时间:2023-06-01

        • <tfoot id='47Car'></tfoot>

            <legend id='47Car'><style id='47Car'><dir id='47Car'><q id='47Car'></q></dir></style></legend>

              <bdo id='47Car'></bdo><ul id='47Car'></ul>

              <small id='47Car'></small><noframes id='47Car'>

                <i id='47Car'><tr id='47Car'><dt id='47Car'><q id='47Car'><span id='47Car'><b id='47Car'><form id='47Car'><ins id='47Car'></ins><ul id='47Car'></ul><sub id='47Car'></sub></form><legend id='47Car'></legend><bdo id='47Car'><pre id='47Car'><center id='47Car'></center></pre></bdo></b><th id='47Car'></th></span></q></dt></tr></i><div id='47Car'><tfoot id='47Car'></tfoot><dl id='47Car'><fieldset id='47Car'></fieldset></dl></div>
                  <tbody id='47Car'></tbody>
                1. 本文介绍了从 ACAccountStore 打开 Twitter 设置 (iOS 5.1 TWITTER)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  在 iOS 5.0 中,我通过

                  in iOS 5.0 i was opening Twitter setting from my app by

                  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=TWITTER"]];

                  但是,这个功能在 iOS 5.1 中被删除了,因此我无法打开 twitter 设置.

                  but , this features is removed in iOS 5.1 , hence i can not able to open twitter setting .

                  现在我正在使用

                   + (void)makeRequestsWithURL: (NSURL *)url {
                  // Create an account store object.
                  ACAccountStore *accountStore = [[ACAccountStore alloc] init];
                  
                  // Create an account type that ensures Twitter accounts are retrieved.
                  ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
                  [self canTweetStatus];
                  
                  // Request access from the user to use their Twitter accounts.
                  [accountStore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) {
                      if(granted) {
                          // Get the list of Twitter accounts.
                          NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
                  
                          // For the sake of brevity, we'll assume there is only one Twitter account present.
                          // You would ideally ask the user which account they want to tweet from, if there is more than one Twitter account present.
                          if ([accountsArray count] > 0) {
                              // Grab the initial Twitter account to tweet from.
                              ACAccount *twitterAccount = [accountsArray objectAtIndex:0];
                  
                  
                              // Create a request, which in this example, posts a tweet to the user's timeline.
                              // This example uses version 1 of the Twitter API.
                              // This may need to be changed to whichever version is currently appropriate.
                              TWRequest *postRequest = [[TWRequest alloc] initWithURL:url parameters:nil requestMethod:TWRequestMethodPOST];
                  
                              // Set the account used to post the tweet.
                              [postRequest setAccount:twitterAccount];
                  
                              // Perform the request created above and create a handler block to handle the response.
                              [postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
                                  NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]];
                                  iOS5Twitter *twitter5 = [[iOS5Twitter alloc] init];
                                  [twitter5 performSelectorOnMainThread:@selector(displayText:) withObject:output waitUntilDone:NO];
                                  [twitter5 release];                }];
                          }
                      }
                  
                  }];
                  

                  }

                  为了提出请求,我可以通过

                  for making request, i am able to check wether i am loged in or not by the

                  if ([TWTweetComposeViewController canSendTweet])

                  但现在我想要:如果我没有登录,它会显示如图所示的警报,并希望移动到 twitter 设置.是否可以 ?或者我必须手动进入 ti twitter 设置?

                  but now i want : if i am not loged in it would be show an alert like shown in image and want to move to the twitter setting . is it possible ? or i have to manually go ti twitter setting ?

                  推荐答案

                  这有点棘手,我通过删除 *TWTWeetComposeViewController* 中的子视图来获得,所以它只在用户不存在时显示警报登录并点击设置按钮,我们可以在我的应用程序中打开设置页面.

                  It is little tricky , i get by the removing the subviews in *TWTWeetComposeViewController*, so it shows only alert when user is not loged in and by the clicking on setting button , we can open Setting page in my app.

                       + (void)setAlertForSettingPage :(id)delegate 
                      {
                       // Set up the built-in twitter composition view controller.
                          TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];
                  
                  
                          // Create the completion handler block.
                          [tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result) {
                              [delegate dismissModalViewControllerAnimated:YES];
                          }];
                  
                          // Present the tweet composition view controller modally.
                          [delegate presentModalViewController:tweetViewController animated:YES];
                          //tweetViewController.view.hidden = YES;
                          for (UIView *view in tweetViewController.view.subviews){
                              [view removeFromSuperview];
                          }
                  
                       } 
                  

                  这里,deleate 是您的视图控制器,如果您在视图控制器中使用此方法,只需使用 self 而不是 delegate.

                  here , deleate is your viewcontroller , if you are using this method inside your viewcontroller just use self instead of delegate.

                  这篇关于从 ACAccountStore 打开 Twitter 设置 (iOS 5.1 TWITTER)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:强制 iOS 应用以横向模式启动 下一篇:如何从ios 5中的源图像中检测面部的肤色?

                  相关文章

                  最新文章

                      <bdo id='nDcqO'></bdo><ul id='nDcqO'></ul>

                    1. <legend id='nDcqO'><style id='nDcqO'><dir id='nDcqO'><q id='nDcqO'></q></dir></style></legend>

                      <tfoot id='nDcqO'></tfoot>

                      <small id='nDcqO'></small><noframes id='nDcqO'>

                      <i id='nDcqO'><tr id='nDcqO'><dt id='nDcqO'><q id='nDcqO'><span id='nDcqO'><b id='nDcqO'><form id='nDcqO'><ins id='nDcqO'></ins><ul id='nDcqO'></ul><sub id='nDcqO'></sub></form><legend id='nDcqO'></legend><bdo id='nDcqO'><pre id='nDcqO'><center id='nDcqO'></center></pre></bdo></b><th id='nDcqO'></th></span></q></dt></tr></i><div id='nDcqO'><tfoot id='nDcqO'></tfoot><dl id='nDcqO'><fieldset id='nDcqO'></fieldset></dl></div>