abjerner / Skybrud.Social

Skybrud.Social is a framework in .NET for integration with various social services like Twitter, Facebook and Instagram. The framework will handle all the technical parts and API communication so you don't have to.
http://social.skybrud.dk/
MIT License
96 stars 32 forks source link

Method not found: 'Int64 Skybrud.Social.SocialUtils.GetUnixTimeFromDateTime' #56

Closed mschraeder closed 8 years ago

mschraeder commented 8 years ago

I'm trying to implement the most recent version of the Core and Instagram and I get this message when I call the GetRecentMedia(userId)


Exception type: MissingMethodException Exception message: Method not found: 'Int64 Skybrud.Social.SocialUtils.GetUnixTimeFromDateTime(System.DateTime)'. at Skybrud.Social.Instagram.Options.Users.InstagramGetUserRecentMediaOptions.GetQueryString() at Skybrud.Social.Http.SocialHttpClient.DoHttpGetRequest(String url, IGetOptions options) at Skybrud.Social.Instagram.Endpoints.Raw.InstagramUsersRawEndpoint.GetRecentMedia(InstagramGetUserRecentMediaOptions options) at Skybrud.Social.Instagram.Endpoints.InstagramUsersEndpoint.GetRecentMedia(Int64 userId)

mschraeder commented 8 years ago

Here is the code I'm using via MVC / Razor (actual token and Id removed)


@{

        InstagramOAuthClient client = new InstagramOAuthClient {
            AccessToken = "abc"
        };

        InstagramService service = InstagramService.CreateFromOAuthClient(client);
        InstagramGetRecentMediaResponse response = service.Users.GetRecentMedia(123);

}   
<section>
    <div class="instagram-feed hidden-xs hidden-sm">
        <div class="container-fluid">
            <div class="row">           
            @foreach (var media in response.Body.Data.Take(6)) {        
                 <div class="col-sm-2"><a href="@media.Link" target="_blank"><img src="@media.LowRes" alt="Instagram Image" class="hvr-shrink"/></a></div>
            }
            </div>
        </div>
    </div>
</section>
abjerner commented 8 years ago

@mschraeder I'm not sure what version(s) you have installed, but from what you write, is it correct that you're using Skybrud.Social.Core and Skybrud.Social.Instagram instead of Skybrud.Social?

Skybrud.Social is still the latest stable release. The plan is to replace Skybrud.Social with Skybrud.Social.Core and individual packages like Skybrud.Social.Instagram, but that still requires some time and work.

Skybrud.Social.Core and Skybrud.Social.Instagram are both still in beta (I should probably make this more clear in the repository readme), and the most recent version of each of them may not be compatible due to some breaking changes here and there. But as far as I remember, Skybrud.Social.Instagram 1.0.0-beta1 should be compatible with Skybrud.Social.Core 1.0.0-beta1, but not Skybrud.Social.Core 1.0.0-beta2.

Anyways, since both Skybrud.Social.Core and Skybrud.Social.Instagram are in beta, you might be better off sticking with Skybrud.Social for now.

I hope this makes sense ;)

mschraeder commented 8 years ago

Understood, however I was forced to upgrade because Instagram was no longer working with the 0.9 installation. I had it running for over a year but on June 1 it stopped working so I thought he new version would fix that.

abjerner commented 8 years ago

That is due to a change in Instagram's guidelines (and API service). They introduced new guidelines back in November, but existing apps would continue to work based on the old guidelines - until the 1st.

For instance, it is no longer possible to use a client id for accessing the API - you now must obtain an access token. Access to a lot of the API endpoints/methods now also require prior approval from Instagram.

If you get the necessary approval from Instagram, Skybrud.Social should still work. However if you need the new public_content scope, you will have to generate the authorization URL manually - I have an example for that here: https://github.com/abjerner/Skybrud.Social/issues/51#issuecomment-217656065