我正在IOS上进行Instagram集成。一切顺利。我正在查看用户的提要并在tableview和滚动视图中显示它们。这是允许用户刷新页面。同时刷新方法由于数组中没有对象,因此没有被调用并且它被崩溃。我使用以下代码来调用该方法。
-(IBAction)loginAction:(id)sender
{
AppDelegate* appDelegate_new = (AppDelegate*)[UIApplication sharedApplication].delegate;
[appDelegate_new.instagram authorize:[NSArray arrayWithObjects:@"comments", @"likes", nil]];
if ([appDelegate.instagram isSessionValid]) {
// NSLog(@"ViewDidLoad Session Valid");
loginView.hidden=YES;
crossButton.hidden=YES;
settingsButton.hidden=NO;
noticeView.hidden=YES;
[self.view addSubview:feedsView];
// [self.logOutView removeFromSuperview];
self.feedsView.frame=CGRectMake(0, 0, 240, 300);
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"users/self/feed", @"method", nil];
[appDelegate.instagram requestWithParams:params
delegate:self];
}
}
被调用的方法就像这样
- (void)request:(IGRequest *)request didLoad:(id)result
{
[self performSelector:@selector(startspinner) withObject:nil afterDelay:0.1];
self.data = (NSMutableArray *)[result objectForKey:@"data"];
// NSLog(@"Data Count is %@",[self.data description]);
createdArray=[[NSMutableArray alloc]init];
//*****Here I am performing Json Parsing******//
}
我在刷新时再次调用上述请求方法
- (void)dropViewDidBeginRefreshing:(ODRefreshControl *)refreshControl
{
[createdArray removeAllObjects];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"users/self/feed", @"method", nil];
[appDelegate.instagram requestWithParams:params
delegate:self];
[self performSelector:@selector(refreshData) withObject:nil afterDelay:5.0];
}
请告诉我哪里出错了。修正了。谢谢。提前谢谢。
答案 0 :(得分:0)
试试吧......
[NSTimer scheduledTimerWithTimeInterval:0.5f
target:self
selector:@selector(showTime)
userInfo:NULL
repeats:YES];
- (void)showTime
{
NSLog(@"Method called");
}
经常使用NSTimer进行通话方式 希望我能帮忙。