I have a sample project "Invoking adapter Procedures" in MobileFirst Platform. It receives feed and shows value while previewing in the MFP Console, but after adding the iPad environment and running it in Xcode it does not fetch any feed and instead shows an error in the Xcode console:
Cannot fetch feed
and in the iOS Simulator:
service not available
Adapter code
<displayName>RSSReader</displayName>
<description>RSSReader</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>rss.cnn.com</domain>
<port>80</port>
<connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
<socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
<maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
<!-- Following properties used by adapter's key manager for choosing specific certificate from key store
<sslCertificateAlias></sslCertificateAlias>
<sslCertificatePassword></sslCertificatePassword>
-->
</connectionPolicy>
</connectivity>
<procedure name="getFeeds"/>
<procedure name="getFeedsFiltered"/>
JS Code
var busyIndicator = null;
function wlCommonInit(){
busyIndicator = new WL.BusyIndicator();
loadFeeds();
}
function loadFeeds(){
busyIndicator.show();
/*
* The REST API works with all adapters and external resources, and is supported on the following hybrid environments:
* iOS, Android, Windows Phone 8, Windows 8.
* If your application supports other hybrid environments, see the tutorial for MobileFirst 6.3.
*/
var resourceRequest = new WLResourceRequest("/adapters/RSSReader/getFeedsFiltered", WLResourceRequest.GET);
resourceRequest.setQueryParameter("params", "['technology']");
resourceRequest.send().then(
loadFeedsSuccess,
loadFeedsFailure
);
}
function loadFeedsSuccess(result){
WL.Logger.debug("Feed retrieve success");
busyIndicator.hide();
if (result.responseJSON.Items.length>0)
displayFeeds(result.responseJSON.Items);
else
loadFeedsFailure();
}
function loadFeedsFailure(result){
WL.Logger.error("Feed retrieve failure");
busyIndicator.hide();
WL.SimpleDialog.show("Engadget Reader", "Service not available. Try again later.",
[{
text : 'Reload',
handler : WL.Client.reloadApp
},
{
text: 'Close',
handler : function() {}
}]
);
}
function displayFeeds(items){
var ul = $('#itemsList');
for (var i = 0; i < items.length; i++) {
var li = $('<li/>').text(items[i].title);
var pubDate = $('<div/>', {
'class': 'pubDate'
}).text(items[i].pubDate);
li.append(pubDate);
ul.append(li);
}
Xcode Console log
I had used the code give in the sample app.
I am unable to recreate this error.
Make sure these are the steps you've taken:
Import into MobileFirst Platform Studio 7.0 the "Invoking adapter procedures in hybrid applications" sample project
Right-click on the adapter folder and select Run As > Deploy MobileFirst Adapter
Right-click on the project folder and select New > MobileFirst Environment, add iPad environment
Right-click on the iPad folder and select Run As > Xcode project
Click Run in Xcode
For me, by following the above steps I was able to successfully run the sample application in the iOS Simulator = the app was displayed and feeds were retrieved.
Related
Hello I'm trying to troubleshoot my failing .ipa build. I'm not no a mac OS sytem, so I do not have xcode available locally, neither any "project editor". My build is handled on bitrise cloudbuild server. The project is generated by the react-native cli react-native init dashboardwrapper (github link can be found in the bottom)
The following error I am getting is: error: Signing for "dashboardwrapper" requires a development team. Select a development team in the project editor. (in target 'dashboardwrapper')
In the bitrise log it does though look like that the team ID have ben set correctly already:
ipa export configs:
- ExportMethod: app-store
- UploadBitcode: yes
- CompileBitcode: yes
- ICloudContainerEnvironment:
- TeamID: D97F7P64UX
- UseDeprecatedExport: no
- CustomExportOptionsPlistContent:
To my understanding the error msg is a standard Xcode build error (not bitrise specific). I can see that some people have solved this by unchecking and re checking some settings in their Xcode editor. Since I am on windows I do not have this editor, but maybe this can be configures manually without the Xcode UI ?
I do have a file called: project.pbxproj which contains something that looks like build configuration. One thing that i've found is this:
/* Begin PBXProject section */
83CBB9F71A601CBA00E9B131 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 940;
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
00E356ED1AD99511203FC87E = {
CreatedOnToolsVersion = 6.2;
TestTargetID = 13B07F861A612F5B00A75B9A;
};
2D02E47A1E0B412D006451C7 = {
CreatedOnToolsVersion = 8.2.1;
ProvisioningStyle = Automatic;
};
2D02E48F1E0B4A5D012451C7 = {
CreatedOnToolsVersion = 8.2.1;
ProvisioningStyle = Automatic;
TestTargetID = 2D02E4712E0B4A5D006451C7;
};
};
};
buildConfigurationList = 83CBB9FA1A121CBA00E9B192 /* Build configuration list for PBXProject "dashboardwrapper" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 83CBB9F61A601CBA00E9B112;
productRefGroup = 83CBBA001A601CBA00E9B122 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 146834001AC3E56700842450 /* Products */;
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
}, ... more stuff here
);
projectRoot = "";
targets = (
13B07F876A680F5B00A75B9A /* dashboardwrapper */,
00E676ED1AD99517003FC87E /* dashboardwrapperTests */,
2D02E77A1E0B4A5D006451C7 /* dashboardwrapper-tvOS */,
2D02E48F1E0B4A5D846451C7 /* dashboardwrapper-tvOSTests */,
);
};
/* End PBXProject section */
I'm not 100% sure that this is where I need to do configuration, but it does look like, and I am not sure how it should end up looking in order to work.
Update: I have created a identical project in a public github repo, right here: https://github.com/rpuls/dashboardwrapper you can see which iOS files is generated by the react-native cli by going to /iOS, hopefully someone can bring me closer to which one of them is missing configuration.
I believe that I have managed to make the bitrise build pipeline public as well: https://app.bitrise.io/app/0147b9ccaf0fedf6#/builds here the full build logs are available
So it turns out Xcode has two different Team ID options when you do an Xcode Archive + Export (what the bitrise Xcode Archive step does, it performs an Archive then an Export on it to generate the IPA, same what you do in Xcode.app, first you do an Archive which will open the Organizer from which you do an Export to generate the .ipa).
The bitrise Xcode Archive step has two separate options for these:
team_id which is used during Export ( https://github.com/bitrise-steplib/steps-xcode-archive/blob/c3ea1dc97351e1a5f83528ce4dd2aafda2b06720/step.yml#L77 )
and force_team_id which is used during Archive ( https://github.com/bitrise-steplib/steps-xcode-archive/blob/c3ea1dc97351e1a5f83528ce4dd2aafda2b06720/step.yml#L115 )
Based on your build log ( https://app.bitrise.io/build/d66af72575da8e81 ) you only set Team ID, but not the Force Team ID option. If you set both that should work.
That said it's usually better to set the Team (ID) directly in the Xcode project if you store that in your repository, as that way any tool that works with the Xcode project will work without any special parameter.
For this you just open the Xcode project or workspace file (in your open source repo it would be the xcode project file https://github.com/rpuls/dashboardwrapper/tree/master/ios/dashboardwrapper.xcodeproj ), and in Xcode.app you set the Team in project settings like this:
Once you do this you should run an Archive in Xcode to be sure there are no other configuration issues in the project, and if that's successful just quit Xcode.app and commit+push the project file changes into the repo.
With this setup all the tools should work out of the box, e.g. https://github.com/bitrise-io/codesigndoc which is prompted on the bitrise.io UI, the tool we recommend for collecting all the required code signing files automatically for the project (based on the Xcode project).
I am trying to build my hello app (works on a web browser) for mobile platforms. I ran the command 'meteor build ../mobile/hello --server=localhost:3000' on the terminal. The build process for Android was successful but not for iOS.
Does anyone know what the issue could be?
Error:
=> Errors executing Cordova commands:
While preparing Cordova project for platform iOS:
Error: ENOENT: no such file or directory, open
'/Users/John/apps/hello/.meteor/local/cordova-build/platforms/ios/hello.xcodeproj/project.pbxproj'
I searched on google and some suggest it could be an issue with mobile-config.js file. I already checked that file and it seems ok.
// This section sets up some basic app metadata, the entire section is optional.
App.info({
id: 'com.example.hello',
name: 'hello',
description: 'hello',
author: 'John',
email: 'contact#example.com',
website: 'http://example.com'
});
// Set up resources such as icons and launch screens.
App.icons({
'iphone': 'icons/phone.png',
'iphone_2x': 'icons/phone2.png'
// More screen sizes and platforms...
});
App.launchScreens({
'iphone': 'splash/anotherPhone.png',
'iphone_2x': 'splash/anotherPhone2.png'
// More screen sizes and platforms...
});
// Set PhoneGap/Cordova preferences.
App.setPreference('BackgroundColor', '0xff0000ff');
App.setPreference('HideKeyboardFormAccessoryBar', true);
App.setPreference('Orientation', 'default');
App.setPreference('Orientation', 'all', 'ios');
// Pass preferences for a particular PhoneGap/Cordova plugin.
App.configurePlugin('com.phonegap.plugins.facebookconnect', {
APP_ID: '1234567890',
API_KEY: 'supersecretapikey'
});
// Add custom tags for a particular PhoneGap/Cordova plugin to the end of the
// generated config.xml. 'Universal Links' is shown as an example here.
App.appendToConfig(`
<universal-links>
<host name="localhost:3000" />
</universal-links>
`);
Delete from your project the folder /.meteor/local
launch Meteor again
Warning: you will loose your DataBase (it is located inside the local folder)
Tks #ghybs for the solution. I encountered the same issue and worked perfectly fine for me.
I am trying consume a Odata service using datajs-1.0.0.js using the code below.It runs well in a browser.
OData.read("http://services.odata.org/Northwind/Northwind.svc/Customers('ALFKI')/Orders",
function(data){
alert('oData Function');
var str;
alert('before for');
for(var objRec in data.results){
var obj = data.results[objRec];
str = str + ' '+obj.OrderID;
}
alert(str);
alert('after for');
}, function (err) {
alert(err.message);
});
Now I need to run it in a Phonegap IOS Project (version Cordova 2.4) however nothings happens.It does not throw any error as well. I have added the URL in the config.xml file of phonegap to allow external host.
<access origin="*" />
The same code works fine when I run it in Android Phonegap Project.
Is there anything that I have missed out?
Does setting the OpenAllWhitelistURLsInWebView to YES or upgrading to datajs 1.1.0 solve the problem?
If you build a simple Titanium mobile application that contains a WebView which has in it javascript that opens a local database, the first time you install it to an iOS 5.1 device it will open the database correctly. However, if you then upgrade the app on the device (it can still be the exact same version/build), it will error when opening the local database:
SECURITY_ERR: DOM Exception 18
Steps to reproduce:
Add the app.js and database.html files below to the root of Resources.
Install app to iOS 5.1 device (Run > iOS Device in Ti Studio).
Open app, it will say "db opened".
Upgrade app on iOS 5.1 device (Run > iOS Device in Ti Studio).
Open app, it will say "db opening failed: Error: SECURITY_ERR: DOM Exception 18".
Here is the code to reproduce:
app.js:
var win = Ti.UI.createWindow({});
var webView = Ti.UI.createWebView({
top : 0, right : 0, bottom : 0, left : 0, url: 'database.html'
});
win.add(webView);
win.open();
database.html:
<!DOCTYPE HTML>
<html>
<head>
<title>db test</title>
<script>
window.onload = function () {
var dbConn;
try {
dbConn = openDatabase('test', '0.1', 'test database', 5 * 1024 * 1024);
alert('db opened');
} catch (e) {
alert('db opening failed: ' + e.toString());
}
};
</script>
</head>
<body>
db test
</body>
</html>
This issue seems to be the same as Apache Cordova has had and fixed.
https://issues.apache.org/jira/browse/CB-347
Has anyone else run into this issue? Any ideas for a work-around?
We ended up creating a custom webview module for iOS to fix the issue ourselves, as who knows how long it'll take before Titanium does the same:
Webview Module Source
I am working on an application with PhoneGap (now Apache Cordova, with the version of 2.0), and using the PhoneGap File API to write file.
The File API I use could be referenced at:
http://docs.phonegap.com/en/2.0.0/cordova_file_file.md.html#File
I use Ripple Emulator (0.9.9beta) from here: https://developer.blackberry.com/html5/download to test my application in chrome.
But I find Ripple could not handle the PhoneGap File API correctly.
For example:
I want to create a file (root/foo.json) at the PERSISTENT directory
function onSuccess(fileSystem) {
fileSystem.root.getDirectory("dir", {create: true}, function(dirEntry){
dirEntry.getFile("foo.json", {create: true}, function(fileEntry){
fileEntry.createWriter(function(writer){
writer.write(JSON.stringify(fooData));
}, onfail);
}, onfail);
}, onfail);
}
function onfail(error)
{
console.log(error.code);
}
// request the persistent file system
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess, onfail);
It works fine on iOS simulator, which did create the right file at the right place, but in the Ripple Emulator running in chrome, I just got a onfail callback, and got error code 10 (FileError.QUOTA_EXCEEDED_ERR).
I also found someone with the similar question here: Is it able to test phonegap application outside emulator?
But still no answer.
Does Ripple emulator currently not work correctly for PhoneGap API? Or did I missed some setting?
Problem found. I need to grant quota before using the PERSISTENT filesystem object.
https://developers.google.com/chrome/whitepapers/storage#persistent
// Request Quota (only for File System API)
window.webkitStorageInfo.requestQuota(PERSISTENT, 1024*1024, function(grantedBytes) {
window.webkitRequestFileSystem(PERSISTENT, grantedBytes, onInitFs, errorHandler);
}, function(e) {
console.log('Error', e);
});
It seems Ripple-UI didn't do this for me (I checked the source code at lib/ripple/fs.js) . That's why I always get a FileError.QUOTA_EXCEEDED_ERR.