vlasov / CCBottomRefreshControl

MIT License
319 stars 77 forks source link

Usage in UITableViewController #1

Closed minakolta closed 10 years ago

minakolta commented 10 years ago

I have UITableViewController defined as follow

    @interface LogViewController : UITableViewController

in viewDidLoad i used the snippet in the home page

    UIRefreshControl *bottomRefreshControl = [UIRefreshControl new];
    [bottomRefreshControl addTarget:self action:@selector(loadMoreData) forControlEvents:UIControlEventValueChanged];
    self.tableView.bottomRefreshControl = bottomRefreshControl;

But when i open the table controller application crashes with that error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableView rac_signalForSelector:]: 

which is caused from

[[self rac_signalForSelector:@selector(didMoveToSuperview)] subscribeNext:^(id x) {

            @strongify(self);
            [[self superview] insertSubview:self.context.fakeTableView aboveSubview:self];
            [self layoutFakeTableView];
        }];

in UIScrollView+BottomRefreshControl.m Line:67 obviously am using UITableViewController which is subclass from UIScrollView and in the example which is working good also TableViewController extending ScrollViewController , I need help because something is wrong maybe wrong delegate assigned early or something.

vlasov commented 10 years ago

Hi, Mina!

I suppose ReactiveCocoa isn’t linked properly to your project.. Would you provide me whole you project zipped in one file, so I could figure out the source of this crash. I swear, I do not copy any piece of your code ))

Nick.

On 19 марта 2014 г., at 1:06, Mina Kolta notifications@github.com wrote:

I have UITableViewController defined as follow

@interface LogViewController : UITableViewController

in viewDidLoad i used the snippet in the home page

UIRefreshControl *bottomRefreshControl = [UIRefreshControl new];
[bottomRefreshControl addTarget:self action:@selector(loadMoreData) forControlEvents:UIControlEventValueChanged];
self.tableView.bottomRefreshControl = bottomRefreshControl;

But when i open the table controller application crashes with that error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableView rac_signalForSelector:]: which is caused from

[[self rac_signalForSelector:@selector(didMoveToSuperview)] subscribeNext:^(id x) {

        @strongify(self);
        [[self superview] insertSubview:self.context.fakeTableView aboveSubview:self];
        [self layoutFakeTableView];
    }];

in UIScrollView+BottomRefreshControl.m Line:67 obviously am using UITableViewController which is subclass from UIScrollView and in the example which is working good also TableViewController extending ScrollViewController , I'am newbie in IOS and i need help because something is wrong maybe wrong delegate assigned early or something , am ready to give more details.

— Reply to this email directly or view it on GitHub.

minakolta commented 10 years ago

It's Not Really applicable for the current situation :) , But i really appreciate your effort. it is solved and the problem was wrong linking like you said , I've already imported CCBottomRefreshControl manually, So i had 2 versions liked with the workspace one in my project and the other with CocoaPods, i removed all manually added libraries and used Pods for all of them.

after that it worked Great :+1: