Created
September 10, 2012 18:25
-
-
Save tmilewski/3692734 to your computer and use it in GitHub Desktop.
Accessing Twitter Accounts in iOS5+ via RubyMotion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GOTCHAS: | |
Adding a Twitter account via the iOS5 simulator does not seem to work. Therefore, you'll need to upgrade to the iOS 6.0 Beta. | |
cd /Library/RubyMotion/data/6.0 | |
rake update --trace | |
sudo xcode-select -switch /Applications/Xcode45-DP4.app/Contents/Developer/ | |
PLEASE NOTE: | |
- Developer Preview 4 was the most current release at the time of writing this. | |
- None of the code below is specific to the iOS 6.0 Beta. | |
- iOS 6.0 Beta is a *Pre-Release* version of iOS. It is *Apple Confidential Information*. It cannot be discussed here because this is a public forum. Please do not post code that contains iOS 6.0 information (such as API calls) in public places (here or GitHub for instance). | |
- Xcode 4.5 Developer Preview / iOS 6.0 Beta can't be used for App Store submissions at this point. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def loadTwitterAccounts | |
@accountStore = ACAccountStore.alloc.init | |
@accountType = @accountStore.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter) | |
@accountStore.requestAccessToAccountsWithType @accountType, withCompletionHandler: lambda { |granted, error| | |
UIApplication.sharedApplication.terminateWithSuccess unless granted | |
@accounts = @accountStore.accountsWithAccountType(@twitterAccountType) || [] | |
# Do what you will with @accounts | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment