【问题标题】:Dynamically add URL Scheme in IOSIOS动态添加URL Scheme
【发布时间】:2014-02-10 13:41:31
【问题描述】:

我在我的应用中实现了使用 Instagram 登录。我在 Instagram 上制作了一个应用程序并获取了用于调用 API 的客户端 ID 和密钥。

但根据 Instagram 文档,每小时只有有限的 API 请求。

那么,How can I solve this?

My idea: 我的一个解决方案是。用户将创建自己的Client ID & Secret Key,然后粘贴到应用程序中以调用 API。

但我的问题是how can I add the this dynamic keys as a URL Schemes into the plist? 我从一个应用程序中得到这个想法,该应用程序与 Twitter API 相同。

任何帮助/解决方案/参考将不胜感激。

提前致谢。

【问题讨论】:

标签: ios iphone objective-c api instagram


【解决方案1】:

试试这个但没有测试..

NSDictionary *infoList = [[NSBundle mainBundle]infoDictionary];        

    NSDictionary *urlScheme=[[infoList valueForKey:@"CFBundleURLTypes"] objectAtIndex:0];

    NSLog(@"url scheme before:%@",urlScheme);

    [urlScheme setValue:[NSArray arrayWithObject:@"New Scheme Name"] forKey:@"CFBundleURLSchemes"];

    NSLog(@"url scheme after:%@",urlScheme);

【讨论】:

  • Info.plist 文件是只读的。你也在不可变对象上面的代码中发生变异。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-02-06
  • 1970-01-01
相关资源
最近更新 更多