Giter VIP home page Giter VIP logo

swifter's People

Contributors

131e55 avatar agermanidis avatar alexdd55 avatar burritofanatic avatar d6u avatar enchan1207 avatar gecko655 avatar harlanhaskins avatar ihla avatar jonasgessner avatar jtp3xp avatar kyome22 avatar lk251 avatar lukewakeford avatar mattdonnelly avatar meteochu avatar mironal avatar noppefoxwolf avatar robertodias180 avatar s-aska avatar salexkidd avatar silent404 avatar tarasis avatar thinkclay avatar tkersey avatar tsuchikazu avatar vikramjeetd avatar weipin avatar zachwolfe avatar zntfdr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swifter's Issues

Unwrapping Issue

I'm getting a lot of those errors in Xcode 6.0 (6A313) and iOS 8:

Swifter/SwifterHTTPRequest.swift:238:140: error: operand of postfix '!' should have optional type; type is 'NSString'
        let localizedDescription = SwifterHTTPRequest.descriptionForHTTPStatus(self.response.statusCode, responseString: responseString!)

Am I missing something?

Swift Compiler Errors for type JSON

Using Xcode Version 6.1 (6A1027)

I installed by dragged the Swifter directory into my project (minus the Bridging Header and info.plist, though I copied the import statement from Swifter's Bridging Header into my own). It looks like that part worked, since Xcode recognized the Swifter class in my app code.

When I tried to build it though, I got these errors (JSON.swift:364) :

Type 'JSON' does not conform to protocol 'StringLiteralConvertible'

Protocol requires function 'convertFromStringLiteral' with type '(JSON.StringLiteralType) -> Self'
Candidate has non-matching type '(String) -> JSON'
Type 'JSON' does not conform to protocol 'UnicodeScalarLiteralConvertible'

Protocol requires function 'convertFromUnicodeScalarLiteral' with type '(JSON.UnicodeScalarLiteralType) -> Self'
Type 'JSON' does not conform to protocol 'ExtendedGraphemeClusterLiteralConvertible'

Protocol requires function 'convertFromExtendedGraphemeClusterLiteral' with type '(JSON.ExtendedGraphemeClusterLiteralType) -> Self'
Candidate has non-matching type '(String) -> JSON'

Release settings?

Have you considered adding some documentation on using Swifter in shipping products? I just attempted to build a project including Swifter for an Ad Hoc build and it failed. I'd prefer not to change the project settings for the framework, but am unclear if that will be necessary to get the project to build ad hoc or not.

Share swifter instance across multiple view controllers in uitabbarcontroller

Hello, as the Swifter instance cannot be stored using NSUserDefaults, i cannot share the authorized instance across multiple view controllers in UITabBarController. Also, as Twitter login is not required, but recommended, I cannot show the Login page every time (it would be a bad user experience too). Can this be done?

Use of unresolved identifier 'Swifter'

I'm new to iOS programming so maybe you could provide a little more detail on how to add the framework.

I dragged the swifter xcode project into my project.

And added the framework .. I think:

screenshot

But am getting the error:
Use of unresolved identifier 'Swifter'

Cursor Values Throw Error

I believe the previous and next cursor values returned by

getFriendsListWithScreenName(screenName: String, cursor: Int?, count: Int?, skipStatus: Bool?, includeUserEntities: Bool?, success: ((users: [JSONValue]?, previousCursor: Int?, nextCursor: Int?) -> Void)?, failure: FailureHandler?)

are the reason I get this error

fatal error: floating point value can not be converted to Int because it is greater than Int.max

I've been using 200 as my requested count (the max allowed by Twitter). When the list is not very big (e.g. 'nasa_neemo' follows 59 users) the request works fine. I believe that's because there are no cursors returned. But 'nasa' follows 230 users and throws the error.

Am I doing something wrong? Are others using cursors returned from this function successfully? thanks

Authentication problem for stream using postStatusesFilterWithFollow

I have been trying to resolve an issue where I am getting a 401 error that essentially says that I am not authenticated. Other functionality such as posting and retrieving tweets work great! This problem seems very similar to issue#4, however I just cannot get it to work for me. Can someone spot what might be doing wrong?

    func findTweets(swifter: Swifter){
        let failureHandler: ((NSError) -> Void) = {
            error in
            self.alert(error.localizedDescription)
            println(error.localizedDescription)
        }

        swifter.postStatusesFilterWithFollow(
            nil,
            track: "#somehashtag",
            locations: nil,
            delimited: nil,
            stallWarnings: nil,
            progress: {
                (statuses: Dictionary<String, JSONValue>?) in
                let recentTweets = self.storyboard.instantiateViewControllerWithIdentifier("RecentTweets") as RecentTweets
                var jsonHolder: [JSONValue] = [];
                if statuses
                {
                    for jsonObjects in statuses!.values {
                        jsonHolder.append(jsonObjects)
                    }
                    recentTweets.stream = jsonHolder
                    self.presentViewController(recentTweets, animated: true, completion: nil)
                }
            },
            stallWarningHandler: {
                (code: String?, message: String?, percentFull: Int?) in
                println("WARNING: \(message)")
            },
            failure: failureHandler
        )
    }

Error:
HTTP Status 401: Unauthorized, Response: \n\n\n<title>Error 401 Unauthorized</title>

Integrating Swifter into Objective C

Has anyone tried to integrate this framework into an objective C project?

I had to make the Swifter class inherit from NSObject (so the objective C side could see it), and even then it's giving me an issue when I try to init the object --

no visible interface for 'Swifter' declares the selector initWithConsumerKey

I checked the SwifteriOS-Swift.h (created by the compiler) and it seems correct.

I also have the following in my .h file:

import < SwifteriOS/SwifteriOS-Swift.h >

@import SwifteriOS;
@Class Swifter;

Cant access any list methods in SwifteriOS package

I can't seem to access any of the list methods in the SwifteriOS package, is this only intended for the SwifterMac package? Is there anyway to get the list methods (SwifterLists.swift) available for the SwifteriOS package?

callback isnt coming.

The code below can autorize on safari browser quite well. But the callback isn't happening.

println("NO ACCOUNTS! Trying to takeit for the website.")
self.swifter.authorizeWithCallbackURL(NSURL(string:"com.ttagit://success")!, success: { (accessToken: SwifterCredential.OAuthAccessToken?, response: NSURLResponse) -> Void in

println(accessToken)
var tmp = self.swifter.client.credential?.accessToken?
self.userHelper.saveUserToken(tmp!)
var user = self.userHelper.fetchUserQData()
self.fetchTwitterHomeStream(user)
}, failure: failureHandler)

Any suggestions?

[ASK] Is there any way to Login with Installed Twitter app.?

let swifter = Swifter(consumerKey: TWITTER_CONSUMER_KEY, consumerSecret: TWITTER_CONSUMER_SECRET,appOnly: true)

this does not worked for me.

I Wants to login user from Twitter app as well as Authentication from browser.

From browser it's working.

But it is not redirecting to Twitter app.

Tweeting with media - suggestion

I've recently added the following extension to my own copy of Swifter - I couldn't find anything else that did this, but this supports the new media uploads functionality for twitter and allows me to parse out the media ID so as to be able to tweet with an image.

public extension Swifter {
public func postMediaFile(media: NSData, success: ((status: Dictionary<String, JSONValue>?) -> Void)?, failure: FailureHandler?) {
var path: String = "media/upload.json"

    var parameters = Dictionary<String, AnyObject>()
    parameters["media"] = media
    parameters[Swifter.DataParameters.dataKey] = "media"
    self.postJSONWithPath(path, baseURL: self.uploadURL, parameters: parameters, uploadProgress: nil, downloadProgress: nil, success: {
        json, response in

        success?(status: json.object)
        return

        }, failure: failure)
}

}

JSON.swift --> JSON does not conform to protocol ...LiteralConvertible

After receiving the warning "Module build with older compiler", I saw that I had to recompile it. I tried this multiple times, but it then fails, as JSON.swift has an error in it's extensions. I use GM-seed of Xcode 6.1 beta. The error is "Type JSON does not conform to protocol ...LiteralConvertible" , where ... is all the extensions like IntegerLiteralConvertible, StringLiteralConvertible, etcetera

SwifterHTTPRequest : Ambiguous use of 'filter'

Compile Error: SwifterHTTPRequest.swift:118:43: Ambiguous use of 'filter'
Result: Not able to run my xCode project

File name : "Swifter/SwifterHTTPRequest.swift"

Code which cause for the error:
public func start() {
.
. some lines of code
.
var nonOAuthParameters = self.parameters.filter { key, _ in !key.hasPrefix("oauth_") }
.
. some lines of code
.
}

Is there any solution available for same?

Unresolved identifiers when building 6.1 branch

I get the following Swift Compiler Errors when building in Xcode 6.1 with the Swifter 6.1 branch:

Use of unresolved identifier 'CC_SHA1_DIGEST_LENGTH'
Use of unresolved identifier 'CCHmac'
Use of unresolved identifier 'CCHmacAlgorithm'
Use of unresolved identifier 'kCCHmacAlgSHA1'

I added Swifter to my project by dragging the Swifter.xcodeproj file and Swifter directory (but not the Mac and iOS demo projects) into Xcode. I also added SwifteriOS.framework to the Link Binary With Libraries section under Build Phases.

CCHmac Problem with Swift 1.2

Hi,
i get an error message that i am not able to resolve

Swifter-master/Swifter/String+Swifter.swift:94:3: Cannot invoke 'CCHmac' with an argument list of type '(UInt32, [CChar], UInt32, [CChar], UInt32, UnsafeMutablePointer<CUnsignedChar>)'

any idea how i get this fixed?

Xcode 6 Beta 5

There seems to be a ton of compiler errors being thrown in Xcode 6 Beta 5 that didn't appear in Beta 4. They appear to be due to the changes in optional types conforming to BooleanType in logical expressions. Instead Apple asks that we compare to nil as we did in Objective C.

SwifteriOSDemo is not functional

When the useACAccount flag is set to true, I try to go into the settings of my simulator to login to a Twitter account to see the functionality of the demo project. But, there is an "Unavailable" next to the Twitter logo. Even when I try putting in my login credentials, there is an error for wrong username and password even though the same credentials work on api.twitter.com when trying to log in without the useACAccount flag. If I press the login button without putting in credentials into settings, no error shows. I tried to step through the code, but all of it seems to get skipped over. Seems to be something wrong with "accountStore.requestAccessToAccountsWithType(accountType)."

When the useACAccount flag is set to false, I am able to log in at api.twitter.com, but when Safari redirects to the app, the app still shows the login button, and not the next view controller, and prints out the following message to the console: "SwifterDemoiOS[99220:660821] Warning: Attempt to present <_TtC14SwifterDemoiOS20TweetsViewController: 0xcf3ab60> on <_TtC14SwifterDemoiOS18AuthViewController: 0xcf25310> while a presentation is in progress!"

Error using Web Authentication

When I change to authenticate with "useACAccount = false" I'm getting some errors with CCHmac function.

It used to work with some previous versions of swifter but now I can't.

A screenshot of error:
captura de tela 2014-09-10 as 09 49 31

Can someone help me?

Thanks

Compile errors

I followed your tutorial and added swifter xcode project to my project, but I am getting 151 compilation errors saying - swift compilation error in the SwifteriOS xcode project.

I also tried to build swifteriOS project as it is and get the same compile errors.

getStatusesUserTimelineWithUserID not returning specified user's timeline

Is there an issue with SwifterTimelines.swift/getStatusesUserTimelineWithUserID? - it always get's timeline stream of authenticated user instead of userId specified as a parameter.

Could you please look at line 92 - should it use parameters, including user_id? instead of empty dict - [:] ?

Question about twitter.getFavoritesListWithCount result use

I think it is great library. But I have small question.

I couldn't find contact info for you anywhere, so figured I'd just create this question here.

I just wanna get favorite tweets's 'media_url'

image

but It seems to complicated.

Better solution is possible?

Beta 4

Will you be updating the code to support the Beta 4 release? I notice a number of changes that keep Swifter from compiling in Beta 4.

Authentication problem for stream.

Hi, first of all: great work. This library really shows some Swift power.

I'm trying to connect to the statuses filter stream:

let swifter = Swifter(consumerKey: consumerKey, consumerSecret: consumerSecret, oauthToken: accessToken, oauthTokenSecret: accessSecret)        
swifter.postStatusesFilter(nil, track: ["twitter"], locations: nil, delimited: false, stallWarnings: true, progress: {
            (status: Dictionary<String, AnyObject>?) in
            println("STATUS: \(status)")
        },
        stallWarningHandler: {
            (code: String?, message: String?, percentFull: Int?) in
            println("WARNING: \(message)")
        }
        , failure: {
            (error: NSError) in
            println("ERROR: \(error)")
        }
    )

Unfortunatly, I receive HTTP Status 401: Unauthorized. I tried doing the same via CURL in the terminal, and this worked perfect:

curl --request 'POST' 'https://stream.twitter.com/1.1/statuses/filter.json' --data 'track=twitter' --header 'Authorization: OAuth oauth_consumer_key="xxx", oauth_nonce="xxx", oauth_signature="xxx", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1403441667", oauth_token="xxx", oauth_version="1.0"' --verbose

Could you give it a try to see if it works for you?

Failed to use "getUserStreamDelimited"

Hi.
I tried to use "getUserStreamDelimited", but I got an error. How to stream my user timeline?
When I used "getStatusesSampleDelimited", I got no error.

Code I tried to run:

let swifter = Swifter(consumerKey: consumerkey, consumerSecret: consumersecret, oauthToken: oauthtoken, oauthTokenSecret: oauthtokensecret)
swifter.getUserStreamDelimited(nil, stallWarnings: nil, includeMessagesFromFollowedAccounts: true, includeReplies: true, track: nil, locations: nil, stringifyFriendIDs: nil, progress: { (progress: Dictionary<String, JSONValue>?) in
            progress!.values.array.map({json in println(json)})
            }, stallWarningHandler: {
                (code: String?, mes: String?, percentFull: Int?) in
                if let warning = mes {
                    println("WARNING: ", warning)
                }
            }, failure: {(error: NSError) in
                let errmes = error.localizedDescription
                println("ERROR: ", errmes)
        })

I got an error below.

(ERROR: , HTTP Status 404: Not Found, Response: Unknown URL. See Twitter Streaming API documentation at http://dev.twitter.com/pages/streaming_api

)

Thanks.

[ASK] How do I save the session?

I'm sorry if this is a stupid question, but I'm just learned about OAuth.

I'm using your library for my school's project.

how do I save the login session? so I don't need to relogin everytime I opened my application?

thank you very much and sorry for my bad English.

Integer overflow in 32bit environment

Twitter's status id is now more than 2^32, so we cannot deal with the status id as Int with 32bit environment (such as iPhone4S).

For example, the code doesn't work correctly with iPhone4S, due to integer overflow.

let a:Int = 515496848048390145
print(a) //prints -289275903 

Therefore, I can't use func getStatusesShowWithID(id: Int, ...) to show https://twitter.com/gecko655/status/515496848048390145.

I think Swifter should include the same method with String argument, like
func getStatusesShowWithID(id: String, ...),
or should change the method to func getStatusesShowWithID(id: Int64, ...).

Is it correct?

Is there any api that I can save the accesstoken to keychain and only oauth once

Every time I open the app, it's going to auth once with callback url if ACAccount not exist. Is there any api that I can save the access token to keychain and only auth once and the next time the app is going to get statuses home timeline without auth again. What I am doing right now is use a KeychainAccess library to manually save the access token. But for the getStatusesHomeTimelineWithCount works, do I have to set the SwifterCredential.OAuthAccessToken using the access token which saved to keychain before.

XCode 5 has intellisense bug

I keep getting the following message when trying to edit anything in my project or the swifter project when I add it:

"SourceKit Service Terminated - Editor functionality temporarily limited"

My intellisense stops working as well. Is there a way to fix this?

Authorisation and fetching direct messages

Our Twitter app settings have necessary permissions and a placeholder callback url

We're initialising a swifter object using Swifter(consumerKey, consumerSecret)

Then, we're authenticating via authorizeWithCallbackURL() which bounces out to Safari and back to the app as expected

In the success callback success:{ (accessToken, response) -> Void in ...} – if we fetch direct messages there via getDirectMessagesSinceID() we can get the messages as expected

Subsequent requests in the same app launch or future app launches fail to get the messages with the following response:
{"errors":[{"message":"Your credentials do not allow access to this resource","code":220}]}

We're considering that we might want to store the access token and initialise a new swifter object with Swifter(consumerKey, consumerSecret, oauthToken, oauthTokenSecret) but the key and secret properties on SwifterCredential.OAuthAccessToken are internal only and cannot be accessed.

Can anyone help?
Perhaps we should just do the authentication ourselves, not using Swifter, and then pass the token and secret to initialise our swifter object and make requests from there?

CocoaPod support?

To be honest, I don't know if swift framework pods are supported yet…

All my requests break at SHA1DigestWithKey func

Everytime I try to run this code, it breaks:

    var swifter = Swifter(consumerKey: "MY_API_KEY", consumerSecret: "MY_SECRET_KEY")
    swifter.getListsStatuesWithSlug("xxxxxx", ownerScreenName: "xxxxxx", sinceID: nil, maxID: nil, count: nil, includeEntities: false, includeRTs: false, success: {

        (lists: [JSONValue]?) in


        }, failure: {

            (error: NSError) in

            NSLog(" error => %@ ", error.userInfo)

    })

It seems to do this with a few other swifter functions I have tried, none of them have worked so far.

It breaks in the SHA1DigestWithKey func in the Swifter+String.swift class:
CCHmac(CCHmacAlgorithm(kCCHmacAlgSHA1), keyStr!, keyLen, str!, strLen, result)

EXC_BAD_ACCESS(Code = 1, address = 0x14)

How to disconnect from streaming API?

First of all, congratulations about the amazing work!

Sorry about the stupid question. I'd like to know how to disconnect from the streaming API. I'm using it, but when I get out from a view that was running a streaming API request, it continues searching, and I'd like to disconnect. Anybody can help me?

Thanks a lot and sorry about the english too.

Cannot build to my iPhone device but can still build in simulator

Whenever I try building to my phone I get the follwing error:

dyld: Library not loaded: @rpath/SwifteriOS.framework/SwifteriOS
Referenced from: /var/mobile/Applications/E6F9358C-E8dB-f0CC-8D0C-B21EB5533040/MobileApps.app/MobileApps
Reason: image not found

I have tried looking up this problem on google, but still couldn't find a solution that worked.

Unable to embed framework

After adding the Swifter project to mine, and adding it as an embedded framework, I get a linker error. I created new project, added let swifter = Swifter(consumerKey: "", consumerSecret: "") (with my consumer key/secret in there) to the main view controller and it gives me:

Undefined symbols for architecture i386:
  "__TFC10SwifterIOS7SwifterCfMS0_FT11consumerKeySS14consumerSecretSS_S0_", referenced from:
      __TFC5tweet19FirstViewControllercfMS0_FT7nibNameGSQSS_6bundleGSQCSo8NSBundle__S0_ in FirstViewController.o
      __TFC5tweet19FirstViewControllercfMS0_FT5coderGSQCSo7NSCoder__S0_ in FirstViewController.o
  "__TMdC10SwifterIOS7Swifter", referenced from:
      __TFC5tweet19FirstViewControllercfMS0_FT7nibNameGSQSS_6bundleGSQCSo8NSBundle__S0_ in FirstViewController.o
      __TFC5tweet19FirstViewControllercfMS0_FT5coderGSQCSo7NSCoder__S0_ in FirstViewController.o
      _get_field_types_FirstViewController in FirstViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've tried attaching just the framework directly to the project as well, but this gives me errors saying that "SwifterIOS" is already defined.

Callback URL for twitter

I am trying to set the callback url to "some://success" in twitter application settlings, but it says the url is Not a valid URL format. I noticed in the swifter demo, the call back url is "swifter://success". Did you set this url in twitter application settings? If so, how do you pass the url validation? I am confused.

Contribution to Swifter

Hello,
I used Swifter in an iOS project and have to say it's great. I created a wrapper class around it and a few supporting classes which greatly simplified the access to Twitter. I think it's something that could be used in many other projects and I would like to share them with you. Is there a way I could make my contribution?

Looping through JSONValue for UITableView

Hey man. I couldn't find contact info for you anywhere, so figured I'd just create this question here.

I was using your 1.1 release (or maybe older) and casting to Dictionary<String, Any> but with the custom class, I'm not sure how best to cast into an NSArray for my UITableView now. Check out the code here, it's very minimal, and I'd like to get a blog post up over the weekend showcasing swifter!

fatal error: unexpectedly found nil while unwrapping an Optional value

Affecting this line: https://github.com/mattdonnelly/Swifter/blob/master/Swifter/SwifterAccountsClient.swift#L65

It occurs when I make a postStatusUpdate(status: String, media: NSData, inReplyToStatusID: Int?, lat: Double?, long: Double?, placeID: Double?, displayCoordinates: Bool?, trimUser: Bool?, success: ((status: Dictionary<String, JSONValue>?) -> Void)?, failure: FailureHandler?) request.

Although the request with no image works fine.

I'm getting the image data as let imageData = UIImageJPEGRepresentation(image, 1.0)

Am I doing something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.