Search code examples
iosswiftcocoapodsinstagram-api

InstagramError(kind: invalidRequest, message: "This endpoint has been retired")


I'm using pod 'SwiftInstagram', '~> 1.0.6' for Instagram login and fetching user This error is coming from fetching Instagram followers list.

private var api = Instagram.shared

func getUserFollowers (completionHandler: @escaping (Bool, InstagramUsersObject?, String?) -> Swift.Void) {
        api.userFollowers(success: { (users) in
            // success, got the user followers
            print(users)
            let followersList = self.createJSONObjectForInstagramUsers(data: users)
            let userList = Mapper<InstagramUsersObject>().map(JSONObject: followersList)
            print(followersList)
            completionHandler(true, userList, "")
        }) { (error) in
            // error while fetching user followers
           //InstagramError(kind: invalidRequest, message: "This endpoint has been retired")
            print(error)
            completionHandler(false, nil, error.localizedDescription)
        }
    }

Solution

  • Please understand there are 4 major changes using Instagram API.

    1. Few endpoints are permanently deprecated with effect from 4th April
    2. There is change API response in few cases.
    3. Change in API rate limit from 30th March
    4. No new app registration allowed

    So presently error you are facing is related to the first issue, Please change your code to handle other 3 scenarios.

    https://www.instagram.com/developer/changelog/

    https://www.instagram.com/developer/