andergoig / swiftinstagram Goto Github PK
View Code? Open in Web Editor NEWInstagram API client written in Swift
Home Page: https://git.io/vdNAn
License: MIT License
Instagram API client written in Swift
Home Page: https://git.io/vdNAn
License: MIT License
I think it would be nice if an example project can be provided. Just a demo
Just call this :- let api = Instagram.shared
// Login
api.login(from: navigationController!, success: {
// Do your stuff here ...
}, failure: { error in
print(error.localizedDescription)
})
I'm looking for a method where I can receive user's access token, looks like there is something but it's available privately. Any reasons why?
basically, I try to call the end-point search user and the error said "this endpoint has been retired"
is there any other solution to retrieve user info?
return error "this endpoint has been retired"
just call the end point api.search(user query: String, count: Int? = nil, success: SuccessHandler<[InstagramUser]>?, failure: FailureHandler?)
Add support for Instagram JSON pagination. Currently, the next_url
parameter decoded from the Instagram responses is not used in any way.
Getting syntax error
let jsonDecoder = JSONDecoder()
jsonDecoder.keyDecodingStrategy = .convertFromSnakeCase
Error : Value of type 'JSONDecoder' has no member 'keyDecodingStrategy'
Using Swift 4.0 and Xcode 9.2
Clicking the login button, the example project logs in
After entering all my data into instagram, the view controller returned with an error message
I should get Media data as Instagram Documentation like this Instagram media
I have already Authentication then get media data
Auth -> Fetch Data (Media)
but i got an error like this
[invalidRequest] - invalid media id
I'm expecting to get URL array instead of one string value. In recentMedia(fromUser:success:failure:) method
It's gives only one string value it contains 20 recent media URLs
retrieve follower list data
retrieving Error 1- "This endpoint has been retired" error
1.When retrieving the followerlist data this gave me response gave me this error.
2. I think instagram change endpoints so this framework should be update.
Authentication should succeed
Authentication fails after challenge
When I try to close the InstagramLoginViewController, it stays in memory, which is causing problems for me. Not too sure whats causing this to stay in memory. deinit never gets called inside InstagramLoginViewController. How can this be fixed? Help would be greatly appreciated. Thanks!
It would be great to add some tests to the library using Quick and Nimble.
As of today, I keep getting this error message when I call recentMedia(fromUser: "self"....
This error was non-existent up until today. Here's what gets printed in the console:
The operation couldn’t be completed. (SwiftInstagram.InstagramError error 0.)
I am still able to login and logout. This error only occurs when I call api.recentMedia(fromUser: "self"....
Another thing to note is that when I enter this link in my web browser "https://api.instagram.com/v1/users/self/media/recent?access_token=MYTOKEN", I am able to get a response from Instagram, which proves it is not a problem on Instagrams end. It is possible that they have slightly changed the response as of today, which might be causing problems with this api, but I am not too sure about that.
UPDATE: After digging in further, I have located where the error occurs. Still not sure why it throws an error. After running line 139 (refer to the image below), the app then catches an error and then runs line 156. Please help me fix this problem, thanks!
Retrieve followers
Receiving an error: "The operation couldn’t be completed. (SwiftInstagram.InstagramError error 1.)"
I think I know the why I get this error but I want to make sure I'm not wrong:
I have my client ID and all that, but the permissions has not been reviewed yet.
Also, Instagram says that the use case of "my app is still in development" is not valid and you should only ask when going to production (which is weird, how can I test the data and all that??)
So overall:
Thank you!
There should be no compile errors.
Compile errors in InstagramLoginViewController:
'success' is inaccessible due to 'private' protection level
'failure' is inaccessible due to 'private' protection level
When I run a pod install, I get the following error:
[!] Unable to satisfy the following requirements:
SwiftInstagram (~> 1.1.0)
required by Podfile
None of your spec sources contain a spec satisfying the dependency: SwiftInstagram (~> 1.1.0)
.
You have either:
pod repo update
or with pod install --repo-update
.Note: as of CocoaPods 1.0, pod repo update
does not happen on pod install
by default.
PS: I have many other pods that were successfully able to install, this is the only one that I am having trouble with.
Checklist
How can I get the all media from user? I can get recent 20 media but, I want to get all of them and then will choose lowest liked medias.
Thanks in advance!
let igLoginManager = Instagram.shared
igLoginManager.login(from: vc, success: {
// not callback (success)
}) { (error) in
// not callback (error)
}
I do not get any answers.
Disable implicit OAuth: uncheck
InstagramClientId: my details
InstagramRedirectURI: my details
I get successfully to my page and do not get any response. Please tell me what could be wrong
Add a comment to a media
Return error "Missing "text" attribute"
Should login succesfully.
Not login succesfully. Received an Error in webview.
(see attached screenshot)
This Api can be used on Cocoa development
None
(lldb) po error
▿ DecodingError
▿ dataCorrupted : Context
▿ codingPath : 4 elements
- 0 : CodingKeys(stringValue: "data", intValue: nil)
▿ 1 : _JSONKey(stringValue: "Index 4", intValue: 4)
- stringValue : "Index 4"
▿ intValue : Optional<Int>
- some : 4
- 2 : CodingKeys(stringValue: "location", intValue: nil)
- 3 : CodingKeys(stringValue: "id", intValue: nil)
- debugDescription : "Parsed JSON number <531383683876521> does not fit in Int."
- underlyingError : nil
Instagram sends strings for ids for pretty much everything, but it seems it sends ints for locations. Huge ints at that. They don't fit in 64 bits and the swift parser doesn't like that at all.
Edited/censored offending JSON. The data within the location node hasn't been altered:
{
"pagination": {
"next_max_id": "censored",
"next_url": "censored"
},
"data": [{
"id": "123123123_123123123",
"user": {
"id": "12345678",
"full_name": "Censored",
"profile_picture": "censored",
"username": "censored"
},
"images": {
"thumbnail": {
"width": 150,
"height": 150,
"url": "censored"
},
"low_resolution": {
"width": 320,
"height": 320,
"url": "censored"
},
"standard_resolution": {
"width": 640,
"height": 640,
"url": "censored"
}
},
"created_time": "1515524886",
"caption": {
"id": "12345678",
"text": "censored",
"created_time": "1515524886",
"from": {
"id": "1297516609",
"full_name": "Censored",
"profile_picture": "censored",
"username": "censored"
}
},
"user_has_liked": false,
"likes": {
"count": 17
},
"tags": [],
"filter": "Normal",
"comments": {
"count": 0
},
"type": "image",
"link": "censored",
"location": {
"latitude": -22.951586524616,
"longitude": -43.210792243481,
"name": "Cristo Redentor Rio de Janeiro",
"id": 531383683876521
},
"attribution": null,
"users_in_photo": []
}],
"meta": {
"code": 200
}
}
authentication
bad request error 3 with authentication
1.I will use client side only there is no backend.
2.What should I wrote instagram API's redirect url? Because there is no website or backend.
3.I wrote incorrect url because of this.
When I am prompted the instagram login screen, and I push 'Log in', the success or failure callback should be triggered.
When I am prompted the instagram login screen, and i push 'Log in', I am routed to a Instagram branded, 'page not found' page. None of the callbacks are called and I don't receive an access token.
I inspected the traffic and it looks like the following POST call is resulting in a 404, regardless whether the username or password is correct:
https://www.instagram.com/accounts/login/?force_classic_login=&next=/oauth/authorize%3Fclient_id%CLIENT_ID%26redirect_uri%3DREDIRECT_URI%26response_type%3Dtoken%26scope%3Dbasic
I think the issue may be around this.
Instagram.shared.login(from: self.navigationController!, success: {
print("Success")
}, failure: { error in
print(error.localizedDescription)
})
Can the key be changed from "accessToken" to something unique so that it won't interfere with other uses? I would suggest "andergoig_swiftinstagram_accesstoken".
Hello, I can't install the library with cocoa pods:
pod install
Analyzing dependencies
[!] Unable to find a specification for `SwiftInstagram (~> 1.0.4)`
A feature to remember the user so they do not have to sign in every time would be very useful :)
Receiving data from Instagram
Not receiving data, most of the endpoints have been deprecated. https://www.instagram.com/developer/changelog/
Use .userFollowers request
Add support for multiple session management. Something similar to what Twitter Kit does.
Hi, I am getting this error after upgrading to the latest version (1.1.1) via cocoapods.
I read about it a bit and it looks like a known bug in Swift
https://bugs.swift.org/browse/SR-7180
The problem is that the in older version (1.1.0) I cannot fetch the user media so that's the reason why I upgrade it to the latest one.
Being able to make any request after login. Can't initialize data in request() -> urlSession.dataTask
Error when invoking api.userFollows(...):
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
Error when invoking getInstagramData()=api.user(...):
decoding(message: "The data couldn’t be read because it is missing.") The operation couldn’t be completed. (SwiftInstagram.InstagramError error 0.)
`
static func loginInstagram(from: UINavigationController, completion: @escaping (Error?) -> Void){
let api = Instagram.shared
// Login
//print("Instragam Login")
api.login(from: from, withScopes: [.basic, .publicContent], success: {
completion(nil)
}, failure: { error in
print(error.localizedDescription)
})
}
`
2. Get data button action
`
static func getInstagramData() {
let api = Instagram.shared
api.user("self", success: { userList in
print(SwiftyJSON.JSON(userList))
}, failure: { error in
print(error)
print(error.localizedDescription)
})
}
`
However this works:
Alamofire.request("https://api.instagram.com/v1/users/self?access_token="+api.retrieveAccessToken()!).responseJSON(completionHandler: { response in if let result = response.result.value { let swiftyJSON = JSON(result) print(swiftyJSON) }
Is it possible to get list of followers or follows by userID not self only ?
p.s : I'm still in sandbox mode
The actual is get list of my followers and follows
When I Use api.like service, I get this error "This endpoint has been retired". Media Id is true also.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.