Git Product home page Git Product logo

sbinstagram's Introduction

SBInstagram v2.2

Easy Objective-C framework to show an instagram feed, initially only shows the pictures and the videos preview(picture).

if you need this working with AFNetworking v1.x use version 1.3

if you don't setup an access token or the existing one expire, this framework request a new one with the login view.

Setup

  • You need add the AVFoundation.framework to your project

  • to initialize and setup the default views add the following code.

//init controller
SBInstagramController *instagram = [SBInstagramController instagram];
    
//setting up, data were taken from instagram app setting (www.instagram.com/developer)
instagram.instagramRedirectUri = @"http://www.santiagobustamante.info";
instagram.instagramClientSecret = @"dd9f687e1ffb4ff48ebc77188a14d283";
instagram.instagramClientId = @"436eb0b4692245c899091391eaa5cdf1";
instagram.instagramDefaultAccessToken = @"6874212.436eb0b.9768fd326f9b423eab7dd260972ee6db";
instagram.instagramUserId = @"6874212"; //if you want request the feed of one user
    
//both are optional, but if you need search by tag you need set both
instagram.isSearchByTag = YES; //if you want serach by tag
instagram.searchTag = @"colombia"; //search by tag query

//multiple users id or multiple tags (not both)
instagram.instagramMultipleUsersId = @[@"386407356",@"6874212"];
instagram.instagramMultipleTags = @[@"sea",@"ground",@"fire"]; //if you set this you don't need set isSearchByTag in true
    
instagram.showOnePicturePerRow = YES; //to change way to show the feed, one picture per row(default = NO)
    
instagram.showSwitchModeView = YES; //show a segment controller with view option (default = NO)
    
instagram.loadingImageName = @"SBInstagramLoading"; //config a custom loading image
instagram.videoPlayImageName = @"SBInsta_play"; //config a custom video play image
instagram.videoPauseImageName = @"SBInsta_pause"; //config a custom video pause image
instagram.playStandardResolution = YES; //if you want play a standard resuluton, low resolution per default
    
[instagram refreshCollection]; //refresh instagram feed
		
//push instagram view controller into navigation
[self.navigationController pushViewController:instagram.feed animated:YES];
  • to initialize and setup only the data source add the following code (you can check the project named "SBInstagramDataSourceExample"):
SBInstagramController *instagram = [SBInstagramController dataSource];
    
//setting up, data were taken from instagram app setting (www.instagram.com/developer)
instagram.instagramRedirectUri = @"http://www.santiagobustamante.info";
instagram.instagramClientSecret = @"dd9f687e1ffb4ff48ebc77188a14d283";
instagram.instagramClientId = @"436eb0b4692245c899091391eaa5cdf1";
instagram.instagramDefaultAccessToken = @"6874212.436eb0b.9768fd326f9b423eab7dd260972ee6db";

instagram.instagramMultipleUsersId = @[@"6874212"]; //here you can set 1 or more
instagram.instagramMultipleTags = @[@"colombia", @"england", @"japan"]; //here you can set 1 or more


//to download media you need execute this methods

/* first you need download the initial elements, use this method
 /mediaArray: array of *SBInstagramMediaPagingEntity* 
 /lastMedia: array of the last object (SBInstagramMediaPagingEntity), this is for the pagging
 /error: if anything is wrong
*/
- (void) mediaMultiplesWithComplete:(void (^)(NSArray *mediaArray,NSArray *lastMedia, NSError * error))block;

/*
[instagram mediaMultiplesWithComplete:^(NSArray *mediaArray, NSArray *lastMedia, NSError *error) {
        if (!error) {
            self.currentEntities = [mediaArray mutableCopy]; //your local array
            self.lastEntities = lastMedia; //another local array (save it to paging)
            [self.tableView reloadData]; //reload tableview or whatever you use
        }else{
            NSLog(@"error: %@", error.localizedDescription);
        }
    }];
*/


/* to download the next page you need use this method
 /entites: this is the lastMedia array you saved in the last call
 /mediaArray: array of *SBInstagramMediaPagingEntity* 
 /lastMedia: array of the last object (SBInstagramMediaPagingEntity), this is for the pagging
 /error: if anything is wrong
*/
- (void) mediaMultiplePagingWithArr:(NSArray *)entities complete:(void (^)(NSArray *mediaArray,NSArray *lastMedia, NSError * error))block;

/*
[instagram mediaMultiplePagingWithArr:self.lastEntities complete:^(NSArray *mediaArray, NSArray *lastMedia, NSError *error) {
        if (!error) {
            [self.currentEntities addObjectsFromArray:mediaArray]; //add new media entities
            self.lastEntities = lastMedia; //save it to download next pages
            [self.tableView reloadData]; //reload tableview or whatever you use
        }else{
           NSLog(@"error: %@", error.localizedDescription);
        }
    }];
*/


/* to get the list of people who like the media you need use this method
 /mediaEntity: this is the media entity with we want request the likers
 /likers: array of *SBInstagramUserEntity* 
 /error: if anything is wrong
*/
- (void) likersFromMediaEntity:(SBInstagramMediaEntity *)mediaEntity complete:(void (^)(NSMutableArray *likers, NSError * error))block;

/*
[instagram likersFromMediaEntity:mediaEntity complete:^(NSMutableArray *likers, NSError *error) {
        if (!error) {
			//here yo have the likers array
        }else{
           NSLog(@"error: %@", error.localizedDescription);
        }
    }];
*/

===========

  • this framework needs the AFNetworking v2.x
  • this framework support iOS 6 and above
  • this is a Xcode 6 project (Xcode 5 compatibility)
  • iOS8 compatibility
  • examples with and without storyboard

Change Log

v2.2

  • new segment controller with new design
  • liker for media selected in the datasource implementation
  • bugs fixes in ipad, video, memory management

v2.1.1

  • new segment view
  • likes count in the feed and detail
  • full description in the feed and detail like oficial instagram app

v2.1.0

  • download only data to customezed views
  • data source example with a custom view

v2.0.3

  • video player completely redesigned, bugs fixed

v2.0.2

  • bugs fixed in video player
  • multiple users feed
  • multiple hast tags search

v2.0.0

  • Play videos inline in the feed and in the pic detail
  • Another option to setup
  • Images customized

v1.4.1

  • create a method to refresh the instragram feed

v1.4

  • upgrade AFNetworking framework, now use AFNetworking v2.x
  • username and user picture in the image detail view

v1.3

  • add new way to show the feed, one picture per row

v1.2

  • add support for search by tag
  • new way to init the instagram view controller

v1.1

  • load all instagram photos per demand (lazy loading)
  • add a loading animation
  • add caption field in the picture detail
  • remove PSTCollectionView framework (remove iOS 5 support)

v1.0

  • first version

####feedback?

sbinstagram's People

Contributors

busta117 avatar xhzengaib 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

Watchers

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

sbinstagram's Issues

code signing issues

when I try to run the app I get a whole bunch of code signing issues. can you change this to make it more generic?

Can I get my Instagram account photos?

Hi, I just wanted to know that can I get my Instagram account in this app?
I tried it by changing client secret,client id,user id,access token and redirect uri in SBInstagramController.h but I am still not getting my Instagram account.
Help me if it is possible.
Thank you.

AFNetworking 2.0

Hello Busta117, can we extend support for AFNetworking 2.0? appreciate it. Thanks.

This bug from iOS6.0 running.

Tips:
2014-02-25 09:56:58.592 SBInstagramExample[775:c07] -[__NSCFArray row]: unrecognized selector sent to instance 0x814bd90
2014-02-25 09:57:04.725 SBInstagramExample[775:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFArray row]: unrecognized selector sent to instance 0x814bd90'
*** First throw call stack:
(0x1460012 0x1285e7e 0x14eb4bd 0x144fbbc 0x144f94e 0x3df59 0x18531 0x44302 0x336b 0x1a9d53f 0x1aaf014 0x1a9f7d5 0x1406af5 0x1405f44 0x1405e1b 0x24e87e3 0x24e8668 0x3f665c 0x711d 0x1ce2725)
libc++abi.dylib: terminate called throwing an exception

code in there:
[imgEntity downloadImageWithBlock:^(UIImage *image, NSError *error) {
if (self.indexPath.row == index.row) {
[self.imageButton setBackgroundImage:image forState:UIControlStateNormal];
}
}];

Jack

No results found

I am using my own developer instagram account and should work great, but iam getting "No results found" for no reasons :/ i have sent to you an email explaining better my problem, i would thank if you could answer me. Thanks in advance!

AppDelegate in Swift

on the Appdelegate
SBInstagramController *instagram = [SBInstagramController instagram];
how do i write it in Swift? so it can work for AppDelegate.swift
Thank you

Ipad Issues

Good day,

we have some issues running it on IPad,

  • the UISegmentedController is not aligned properly when the IPad is rotated landscape

ios simulator screen shot dec 2 2014 9 22 50 am

  • ln Listview mode , the video is being played in a smaller frame size

ios simulator screen shot dec 2 2014 9 22 32 am

  • ln collectionview mode , the video is being pushed with a cut from below

ios simulator screen shot dec 2 2014 9 22 48 am

appreciate your usual support

Playing videos ?

hi,
if we could play videos it would be perfect indeed,,

thank you

Refresh Collection View

Hey Busta, i wish to refresh the collection view through a custom navigation bar button. which specific methods should i be calling?

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.