MGTwitterEngine“默认”推文数量?

发布于 11-11 08:34 字数 1286 浏览 1 评论 0原文

这是我的问题!我正在使用 MGTwitter 引擎,并且几乎所有内容都可以工作,从推文到 screen_names 转发计数和头像都放置在表视图中。我不明白的是,如果我添加任何类型的已知“计数”,它会在第 19 个单元格之后滚动时崩溃,

它始终是崩溃的第 19 个单元格......???

这就是我获得计数的方式

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{





int count = [tweets count];


// if there's no data yet, return enough rows to fill the screen
   if (count == 0)
    count = kCustomRowCount;


// count = 50; -----this does not work ! it will crash when scrolling!?

return count ; 
return [avatarsURL count];
//return [retweetCount count];
//return [avatars count];


}

因此,如果我只是返回计数,如上面“返回计数;”所示一切正常,但每次都会收到随机数量的推文,范围为 10 - 20 条推文,绝不会超过 20 条……如果您无法获得超过 20 条推文,那么拥有 Twitter 引擎有何意义?所以我进去添加您看到的行

“count = 50;”当滚动到第 19 个单元格时,它崩溃了!无论我将这个数字设置为多少,它都会这样做......例如:

 count = 21;

它仍然会崩溃......???还困惑吗?我......也许我返回的计数都是错误的,有人可以启发我更好的方法来返回你的计数......并且是的,我在类的顶部定义了 kCustomRowCount......

所以我的第一反应是我做错了什么,但我看了又看,似乎看不到什么......然后我做了一些测试,发现它似乎在 19 单元上崩溃,众所周知 iOS整数从零开始。这意味着可能有默认的推文计数。

所以,当然,我打开 MGTwitter Engine 并开始浏览,但运气不佳,我用 google 搜索,发现 MGTwitterEngine.h 中曾经有一个默认的推文计数为 20 条推文,但在我的版本中没有!所以我只是添加了#define,但这不起作用!因此,如果任何人对如何解决此问题有任何建议,或者是否存在默认推文计数,那么我可以将其从等式中取消!

谢谢 希望尽快找到解决办法!

Here is my issue! I am using MGTwitter Engine and have just about everything working from tweets to screen_names re-tweet count and avatars all placed in the table view. What I do not understand is if I add any type of known "count" it will crash on scrolling after the 19 cell

its always the 19 cell it crashes on...????

This is how I get my count

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{





int count = [tweets count];


// if there's no data yet, return enough rows to fill the screen
   if (count == 0)
    count = kCustomRowCount;


// count = 50; -----this does not work ! it will crash when scrolling!?

return count ; 
return [avatarsURL count];
//return [retweetCount count];
//return [avatars count];


}

So if I just return count as seen above "return count;" everything works fine but it gets a random number of tweets every-time ranging from 10 - 20 tweets NEVER more then 20.....what is the sence of having a twitter engine if you caint get more then 20 tweets??? So I go in and add the line you see

"count = 50;" and it crashes on scrolling when it get to the 19th cell! No matter what I make that number it does this.... for example :

 count = 21;

It will still crash.....??? Confused yet? I am ...... Maybe I am returning the count all wrong and someone can enlighten me on a better way to return your count.... and YES I have the kCustomRowCount defined at the top of my class....

So My first initial reaction was I did something wrong but I looked and looked and looked and can not seem to see what.... then I did some testing and found that it seems to crash on the 19 cell and as we all know iOS integers start at zero. This means there could be a default Tweet Count.

So of course I open MGTwitter Engine and start browsing through with NO luck and I googled it and found there once was a default tweet count of 20 tweets in MGTwitterEngine.h but NOT in my version !!! So I just added the #define and that doesnt work! So if ANYONE has ANY suggestion on how to fix this or if there is or isnt a default tweet count so I can cancel that out of the equation !

Thank you I hope to find a solution soon!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

聊慰2024-11-18 08:34:48

在 SA_OAuthTwitterEngine.m 中取消注释,

if (params) {
      fullPath = [self _queryStringWithBase:fullPath parameters:params   
        prefixed:YES];
    }

如下所示!别客气.....

 #define SET_AUTHORIZATION_IN_HEADER 1

 - (NSString *)_sendRequestWithMethod:(NSString *)method 
                            path:(NSString *)path 
                 queryParameters:(NSDictionary *)params 
                            body:(NSString *)body 
                     requestType:(MGTwitterRequestType)requestType 
                    responseType:(MGTwitterResponseType)responseType
{
NSString *fullPath = path;

// --------------------------------------------------------------------------------
// modificaiton from the base clase
// the base class appends parameters here
// --------------------------------------------------------------------------------
//  if (params) {
//       fullPath = [self _queryStringWithBase:fullPath parameters:params   
    //    prefixed:YES];
    }
// --------------------------------------------------------------------------------

    NSString *urlString = [NSString stringWithFormat:@"%@://%@/%@", 
                       (_secureConnection) ? @"https" : @"http",
                       _APIDomain, fullPath];
  NSURL *finalURL = [NSURL URLWithString:urlString];
  if (!finalURL) {
    return nil;
  }

in SA_OAuthTwitterEngine.m uncomment

if (params) {
      fullPath = [self _queryStringWithBase:fullPath parameters:params   
        prefixed:YES];
    }

as shown below! your welcome.....

 #define SET_AUTHORIZATION_IN_HEADER 1

 - (NSString *)_sendRequestWithMethod:(NSString *)method 
                            path:(NSString *)path 
                 queryParameters:(NSDictionary *)params 
                            body:(NSString *)body 
                     requestType:(MGTwitterRequestType)requestType 
                    responseType:(MGTwitterResponseType)responseType
{
NSString *fullPath = path;

// --------------------------------------------------------------------------------
// modificaiton from the base clase
// the base class appends parameters here
// --------------------------------------------------------------------------------
//  if (params) {
//       fullPath = [self _queryStringWithBase:fullPath parameters:params   
    //    prefixed:YES];
    }
// --------------------------------------------------------------------------------

    NSString *urlString = [NSString stringWithFormat:@"%@://%@/%@", 
                       (_secureConnection) ? @"https" : @"http",
                       _APIDomain, fullPath];
  NSURL *finalURL = [NSURL URLWithString:urlString];
  if (!finalURL) {
    return nil;
  }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文