1
我正在創建1個移動應用程序。從目標c + sencha touch中調用javascript函數
從appdelegate(iphone),我想調用javascript,它位於我的sencha touch的控制器中,可以幫助我嗎?
我真的被卡住了。
請幫幫我。
在此先感謝。
我正在創建1個移動應用程序。從目標c + sencha touch中調用javascript函數
從appdelegate(iphone),我想調用javascript,它位於我的sencha touch的控制器中,可以幫助我嗎?
我真的被卡住了。
請幫幫我。
在此先感謝。
嘗試使用自定義URL方案。
煎茶API文檔會告訴你下面的代碼添加到您的應用程序::
Ext.application({
name: 'Sencha',
requires: ['Ext.device.Device'],
launch: function() {
if (Ext.device.Device.scheme) {
// the application was opened via another application. Do something:
alert('Applicaton pened via another application: ' + Ext.device.Device.scheme.url);
}
// Listen for future changes
Ext.device.Device.on('schemeupdate', function(device, scheme) {
// the application was launched, closed, and then launched another from another application
// this means onReady will not be called again (because the application is already running in the
// background) - but this event will be fired
alert('Applicated reopened via another application: ' + scheme.url);
}, this);
}
});
爲了確保這部作品,添加自定義網址,您想在打包的應用程序在你的打包如下使用。 json文件::
{
...
"rawConfig": "<key>CFBundleURLTypes</key><array><dict><key>CFBundleURLSchemes</key><array><string>sencha</string></array><key>CFBundleURLName</key><string>com.sencha.example</string></dict></array>"
...
}
編輯::目前只適用於Sencha本地包裝程序,而不是Phonegap。
把你的javascript代碼.. – iPatel 2013-03-12 14:07:46
從appdelegate,我想調用一些function.javascript function..js代碼是在控制器(sencha touch) – 2013-03-12 14:11:01
使用NSULConnecton..for獲取js數據:) – iPatel 2013-03-12 14:18:04