Pregunta

Inside of TWRequest.h that's inside of the Twitter Framework, there it imports this

#import <Social/SLRequest.h>

But TWRequest was built for iOS 5, so why would it import the Social Framework's file since those are for iOS 6?

I'm getting this error..

'Social/SLRequest.h' file not found

Of course it's not found because I didn't add in the Social Framework because I want to use the Twitter Framework. I can't simply remove it because that file is referencing from the Social framework, how can I fix this? Thanks

¿Fue útil?

Solución 2

This seemed more of an xcode problem. Sometimes it worked and sometimes it threw the error. I had to exit xcode and restart for it to work again. It eventually fixed itself.

Otros consejos

In iOS 6 the Twitter framework methods are deprecated. Instead you should use the Social.framework. Which includes sharing both Twitter and Facebook.

The sample code checks what the OS version is running and what framework classes are available whether it iOS 5 - Twitter.framework or 6 - Social.framework

#import <Twitter/Twitter.h>
#import <Social/Social.h>


- (void) postTweet {
NSString *someTweet = @"someTweet";

// running on iOS5
if (NSClassFromString(@"TWTweetComposeViewController") && [TWTweetComposeViewController canSendTweet]) {

    TWTweetComposeViewController *tweetSheet = [[TWTweetComposeViewController alloc] init];

    [tweetSheet setInitialText:someTweet];
    [self presentModalViewController:tweetSheet animated:YES];

    // running on iOS6
} else if ( NSClassFromString(@"SLComposeViewController") && [SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter] ) {

    SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];

    [tweetSheet setInitialText:someTweet];
    [self presentViewController:tweetSheet animated:YES completion:NULL];
}
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top