- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Cordova :1.6.0
iOS: 5.1
X代码:4.3.1
我正在尝试使用一个非常基本的示例程序来访问 Phonegap 1.6.0 中的 handleOpenURL。每次发出 http/https 请求时,我都想分析一个 url。我现在所做的就是添加一条日志消息以查看 url 的主机。
- (BOOL) application:(UIApplication*)application handleOpenURL:
(NSURL*)url
{
NSLog(@"Hi");
NSLog(@"Host: %@", [url host]);
if (!url) {
return NO;
}
...
}
但是,日志消息不会向控制台写入任何内容。
我确实注意到了评论:
// only valid if Example-Info.plist specifies a protocol to handle
也许我的 Example-Info.plist 文件有误?我已经将 CFBundleURLTypes 添加到其中,假设这就是“指定要处理的协议(protocol)”的含义。我必须在某处添加其他内容吗?下面是我的 Example-Info.plist 文件的示例部分。模拟器是否可能无法识别我的 .plist 修改?
...
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>http</string>
<string>https</string>
</array>
</dict>
</array>
由于 handleOpenURL 已被弃用,因此我也有所了解。
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication (NSString *)sourceApplication annotation:(id)annotation
{
NSLog(@"Hi");
...
}
当我在我的应用程序中打开 URL 时,两者都没有被调用。我已经尝试了堆栈溢出中的所有解决方案,但没有这样的运气。如果有任何帮助,我正在使用 jQuery Mobile 1.1.0 进行页面转换。
最佳答案
那不是那些方法的目的。它们将处理用于打开您的应用的 URL,而不是您在 UIWebView 中打开的任何 URL。
您应该查看 UIWebView 的委托(delegate)方法
特别是
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
导航类型:(UIWebViewNavigationType)导航类型
关于带有 Phonegap 1.6.0 的 iOS handleOpenURL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10192448/
我正在使用 URL 方案,以便能够使用 URL 打开我的应用程序。当接收器应用程序运行时它工作正常。 但是,问题是应用程序是否关闭。例如,如果我在 Safari 中输入 url,应用程序将启动并立即崩
假设我已经注册了几个适合我的应用程序的方案,例如文本文件和 PDF。 我在邮件应用程序中打开附件。调用我的应用程序,并使用 URL 触发 handleOpenURL 方法。 我是否必须(粗略地)解析
我在使用 AppDelegate 中的函数时遇到问题 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sou
由于事件的顺序根据这两种情况中的哪一种正在进行而略有不同,我希望能够分辨出不同之处。有什么建议吗? 最佳答案 您不应使用 handleOpenURL,因为它已被弃用。相反,请使用 applicatio
我正在应用中设置 Firebase,但不知道如何在handleOpenURL 函数中分配参数 sourceApplication。我正在尝试遵循 Google 的 Firebase UI 身份验证设置
我正在尝试使用旧教程制作应用程序。自本教程发布以来,发生了很多变化。我需要做一个facebook登录,所以通过一些帖子我了解到,FBAppCalls已更改为FBSDKApplicationDelega
当应用程序在后台打开时收到警报消息。当我在启动应用程序时从后台关闭应用程序时,它不会给我警报消息。首次启动应用程序时,无法在 JavaScript 中调用 handleOpenURL。以下是代码 di
我正在为我的 iPhone 应用程序使用 Facebook API,有两个问题: 所有文档/示例似乎都将所有内容都放在 appDelegate 中:实例化 Facebook 对象并在 appDidFi
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
我的主要选项卡之一是 uiwebview,它链接到整个应用程序的资源。 因此,我正在我的 handleOpenUrl 中构建一个 Restful 路由器。但是我的 regex/obj-c 字符串处理很
我的应用程序从 p12 文件导入一个身份,用于验证对服务器的请求。 这是通过与 iTunes 交换文档并从文件系统加载文件来工作的。 使用我自己的文件扩展名重命名 p12 文件也可以通过电子邮件导入文
我正在尝试为我正在开发的应用程序获取 Instagram 身份验证 token ,我打开了 safari 应用程序,我能够登录,然后它将我发送回该应用程序,但是当它把我转移回该应用程序时, handl
我已经开始探索 Dropbox API 的应用程序,我希望用户能够在其中备份数据库文件。我遇到的问题是,在用户将应用程序与其帐户链接后(类似于通过 Facebook 登录),该应用程序不会返回到前台。
我有一个将使用 Facebook 和 Instagram API 的应用程序,这两个 API 都要求我使用此委托(delegate)方法: - (BOOL)application:(UIApplica
我正在开发一个 PhoneGap 项目,我正在尝试实现一个简单的机制,当 URL 传递到应用程序。可悲的是我遇到了一些绊脚石。问题有两个: 首先我对 sendJavascript 的调用似乎根本不起作
我很难让 Facebook 登录回到我的应用程序中的正确 View 并调用适当的 facebook 函数。 在这个例子中,Facebook 有简单的 [controller facebook] 这是他
我已成功将我自己的 url 方案添加到我的应用程序中。该应用程序使用这些方案正确启动。 现在我想处理传入的数据,但未调用委托(delegate)。这是一个通用应用程序,我已将以下功能添加到两个 App
我已将 FBConnect SDK 实现到我的应用程序中,并且它在模拟器上完美运行。然后,我适本地修改了应用程序的 .plist 文件,并向我的 AppDelegate 添加了当 Facebook 安
Cordova :1.6.0 iOS: 5.1 X代码:4.3.1 我正在尝试使用一个非常基本的示例程序来访问 Phonegap 1.6.0 中的 handleOpenURL。每次发出 http/ht
我正在开发一个应用程序,几乎所有的事情都弄清楚了,除了自定义 URL 方案插件(https://github.com/EddyVerbruggen/Custom-URL-scheme)。我已经成功安装
我是一名优秀的程序员,十分优秀!