如何在 mgtwitterengine api 中保留给定的密码
我想将用户给出的密码保存在变量中。从哪里获取密码值。我查看代码,但它只包含用户名。我在我的应用程序中使用 MGTwitterengine api。这是在控制台上打印数据的函数。
-(void)setUsername:(NSString *)newUsername password:(NSString *)newPassword
{
NSLog(@"uset sername %@ and password %@",newUsername,newPassword);
...
}
我在所有函数中进行调试,但我看到该函数在登录后正在运行。但这在密码值中打印空,尽管用户名打印得很好。实际上我必须追踪用户的所有推文价值。我浏览了 MGTwitterEngine。有一段代码,但是需要写用户名和密码。
这是代码
MGTwitterEngine *twitterEngine = [[MGTwitterEngine alloc] initWithDelegate:self];
[twitterEngine setUsername:@"username" password:@"password"];
// Get updates from people the authenticated user follows.
NSString *connectionID = [twitterEngine getFollowedTimelineFor:nil since:nil startingAtPage:0];
请帮我如何保留密码?
I want to keep password which is given by user in a variable. Where to get password value. I look in code but it is containing only username. I am using MGTwitterengine api in my application. Here is the function which is printing data on console.
-(void)setUsername:(NSString *)newUsername password:(NSString *)newPassword
{
NSLog(@"uset sername %@ and password %@",newUsername,newPassword);
...
}
I debug in all function but I saw this function is running after loggedin. But this is printing null in password value although username is printing well. Actually I I have to trace all tweet value of user. I went through MGTwitterEngine. There is a block of code but it is necessary to write username and password.
Here is the code
MGTwitterEngine *twitterEngine = [[MGTwitterEngine alloc] initWithDelegate:self];
[twitterEngine setUsername:@"username" password:@"password"];
// Get updates from people the authenticated user follows.
NSString *connectionID = [twitterEngine getFollowedTimelineFor:nil since:nil startingAtPage:0];
Please help me how to keep password ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读开发者文档,它提供了您所需的所有信息,就像简单的事情一样这。回到问题,有几种方法可以保存这些数据。
NSUserDefaults:您可以使用此类保存
用户名
和密码
,如下所示:一旦您再次需要此数据,请调用它:
OR :
NSDictionary:如果你不想依赖
NSUserDefaults
,你可以将登录数据保存在NSDictionary
中并保存将其添加到您的沙箱中。它的工作原理如下:然后,一旦您再次需要数据,请从文件中读取:
希望它有帮助!
Read the developer documentation, it provides all the info you need for something as easy as this. Back to the question, there're a couple of ways how you can save this data.
NSUserDefaults: You can save the
username
andpassword
using this class like this:Once you need this data again, call it:
OR:
NSDictionary: If you don't want to rely on
NSUserDefaults
, you can save the login data in aNSDictionary
and save it to your sandbox. This works like this:Then, once you need the data again, read from file:
Hope it helps!