大家。为了创建iOS应用程序,我使用OS X(版本10.11.1),Xcode(版本7.1)和PhoneGap(v5.3.6)。
然后,我写了一个简单的程序 - index.html和rkBLE.js
以下是index.html
。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap:; style-src 'self' 'unsafe-inline'; media-src *">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>Hello World</title>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="rkBLE.js"></script>
</head>
<body>
<center style="margin-top: 150px;">
<form name="hoge" action="#">
<input type="button" name="hoge" value="Bluetooth button" onclick="return rkBLE();" />
</form>
</center>
</body>
</html>
而且,这是rkBLE.js
。
function rkBLE()
{
if(confirm("Rirei Kuroshima"))
return false;
else
return false;
}
我将Mac与iPad Mini连接,然后按下运行/构建按钮将应用程序安装到iPad中。
App已启动,我按了“蓝牙按钮”。但是,弹出事件没有发生。如果有人知道“出了什么问题”,请告诉我原因。
Xcode发布了以下消息:
2015-11-09 16:46:37.619 Hello World[549:107470] <CATransformLayer: 0x12f566dd0> - changing property masksToBounds in transform-only layer, will have no effect
2015-11-09 16:46:37.619 Hello World[549:107470] <CATransformLayer: 0x12f5cefd0> - changing property masksToBounds in transform-only layer, will have no effect
2015-11-09 16:46:37.620 Hello World[549:107470] <CATransformLayer: 0x12f5780e0> - changing property masksToBounds in transform-only layer, will have no effect