gpt4 book ai didi

iphone - 推特 API : Decode string returned by getFollowerIDsFor from Twitter (MGTwitterEngine for Obj-C)

转载 作者:行者123 更新时间:2023-12-03 21:08:32 24 4
gpt4 key购买 nike

新问题

感谢您的回复Arcain。我想问题被误解了。对此我深表歉意。

我的解释就像 getFollowerIDsFor 方法,顾名思义应该是获取关注者 ID 列表,但事实并非如此。

我的实际问题是,如何使用 MGTwitterEngine API 从 Twitter 获取关注者/关注者列表。虽然我查看了文档但无法找到相同的信息。

问候,

詹尼斯

<小时/>

上一个问题

我们可以通过 MGTwitterEngine 对象使用 getFollowerIDsFor 获取关注者列表。它总是返回一些我无法理解的字符串,即如何解码或类似的东西?

假设结果字符串是“025815FA-BAF6-49E6-96B4-86F2D4C8C6CA”

如何理解这个字符串中的内容?谁能强调一下这一点吗?

如果有帮助,我们将不胜感激。

问候,詹尼斯

最佳答案

该值是一个唯一标识符,并不真正意味着任何东西。我对 Cocoa 不熟悉,但是当我环顾四周时,我在 README 中发现了以下内容MGTwitterEngine 文件,它似乎与您所要求的内容相关:

关于从 Twitter 返回的数据的说明

Each Twitter API method returns an NSString which is a uniqueidentifier for that connection.Those identifiers are passed to allthe delegate methods, so you cankeep track of what's happening.

Whenever a request is successful, you will receive a call to yourimplementation of requestSucceeded: soyou'll know that everything went OK.For most of the API methods, you willthen receive a call to the appropriatemethod for the type of data yourequested (statusesReceived:... ordirectMessagesReceived:... oruserInfoReceived:...). The values sentto these methods are all NSArrayscontaining an NSDictionary for eachstatus or user or direct message, withsub-dictionaries if necessary (forexample, the timeline methods usuallyreturn statuses, each of which has asub-dictionary giving informationabout the user who posted thatstatus).

Just try calling some of the methods and use NSLog() to see what data youget back; you should find the formatvery easy to integrate into yourapplications.

Sometimes, of course, requests will fail - that's just how life is. In theunlikely event that the initialconnection for a request can't bemade, you will simply get nil backinstead of a connection identifier,and then receive no further callsrelating to that request. If you getnil back instead of an NSString, theconnection has failed entirely. That'sa good time to check that the computeris connected to the internet, and soon.

It's far more common however that the connection itself will go ahead justfine, but there will be an error onTwitter's side, either due totechnical difficulties, or becausethere was something wrong with yourrequest (e.g. you entered the wrongusername and password, or you tried toget info on a user that doesn't exist,or some such thing). The specificerror conditions are mostly documentedin the Twitter API documentationonline.

In these cases you'll receive a call to requestFailed:withError: which willinclude an NSError object detailingthe error. Twitter usually returnsmeaningful HTTP error codes (like 404for 'user not found', etc), and inthat case the -domain of the NSErrorwill be "HTTP" and the -code will bethe relevant HTTP status code. TheuserInfo of the NSError will contain akey "body" that may contain theresponse body and "response" whichwill contain the NSHTTPURLResponse.This makes it really, really easy toknow what's happening with yourconnections.

关于iphone - 推特 API : Decode string returned by getFollowerIDsFor from Twitter (MGTwitterEngine for Obj-C),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4862855/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com