Dev:Twitter.framework

From The Apple Wiki
Twitter.framework
Public Framework
Availabile?.0 – present


Twitter.framework is (or rather, was) a framework for apps to use as an interface for twitter (ex posting tweets). However iOS 6.0 deprecated this framework, telling people to move to Social.framework. It still technically exists in iOS but the majority of its code is gone.

On iOS 15.2, here is every "surviving" method from it. Technically this means that this framework is 100% documented for iOS 15.2, but obviously it's purpose is for older iOS when it had more functionality than this back then, there's not really much of it left now...

Methods

Class Method Function
TWRequest -initWithURL:parameters:requestMethod: Calls [super init]. Does not do anything with passed in args.
TWRequest -dealloc Calls [super dealloc].
TWRequest -dealloc Calls [super dealloc].
TWRequest -requestMethod Returns 0x1.
TWRequest -URL Returns 0.
TWRequest -account Returns 0.
TWRequest -setAccount Just returns. Doesn't set anything, literally just a ret.
TWRequest -addMultiPartData:withName:type: Just returns. Doesn't set anything, literally just a ret.
TWRequest -signedURLRequest Returns 0.
TWRequest -signedURLRequest Returns 0.
TWRequest -performRequestWithHandler: Just returns. Doesn't set anything, literally just a ret.
TWTweetComposeViewController +canSendTweet Class method, finally something that actually runs code. Anyways this just returns [SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter];.
TWTweetComposeViewController -init This just returns SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter].
TWTweetComposeViewController -setInitialText Returns 0. Just like every setter here, this doesn't set anything.
TWTweetComposeViewController -addImage: Returns 0.
TWTweetComposeViewController -addURL: Returns 0.
TWTweetComposeViewController -removeAllImages Returns 0.
TWTweetComposeViewController -removeAllURLs Returns 0.
TWTweetComposeViewController -setCompletionHandler: Does nothing.
TWTweetComposeViewController -setLongitude:latitude:name: Does nothing.
TWTweetComposeViewController -addURLWithProxyPreviewImage: Does nothing.
TWTweetComposeViewController -addDownSampledImageDataByProxyWithPreviewImage: Does nothing.
NSString -TWTwitterCharacterCountWithShortenedURLLength: The only method that isn't either just a wrapper for Social.framework or has no code in the current version of iOS. Decompilation below.

TWTwitterCharacterCountWithShortenedURLLength:

-(int)TWTwitterCharacterCountWithShortenedURLLength:(int)urlLen {
 /* may be slightly inaccurate */
 NSError *err;
 NSDataDetector *dataDetector = [[NSDataDetector alloc]initWithTypes:NSTextCheckingTypeLink error:&err];
 NSMutableString *ourString = [self mutableCopy];
 NSUInteger thisMethodGetsTheLengthButIDontThinkItEverEvenUsesItLol = [ourString length];
 NSArray *matches = [dataDetector matchesInString:ourString options:nil range:nil];
 long long matchesCount = [matches count];
 unsigned long httpsCount = 0;
 unsigned long httpCount = 0;
 if (matchesCount > 0) {
  for (NSTextCheckingResult *match in matches) {
   if ([match resultType] == NSTextCheckingTypeLink) {
    if ([[[match URL]scheme]compare:@"https" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
     httpsCount += 1;
     [[[match range] replaceCharactersInRange:@"https" withString:@""];
    } else if ([[[match URL]scheme]compare:@"http" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
     httpCount += 1;
     [[match range] replaceCharactersInRange:@"http" withString:@""];
    }
   }
  }
 }
 return [[ourString precomposedStringWithCanonicalMapping]length] + httpCount * urlLen + (urlLen + 1) * httpsCount;
}

Using this framework

Don't. At least, not for modern iOS. If it isn't clear already, use Social.framework instead, there is only a single method here that isn't a wrapper for Social.framework or does nothing. (And if you do need that method, honestly just use my decompilation of it, the method is small enough to where I believe you should be fine legally.)