ios - MobileFirst Platform adapter invocation fails in simulator -
i have sample project "invoking adapter procedures" in mobilefirst platform. receives feed , shows value while previewing in mfp console, after adding ipad environment , running in xcode not fetch feed , instead shows error in xcode console:
cannot fetch feed
and in 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 adapter's key manager choosing specific certificate 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(); /* * rest api works adapters , external resources, , supported on following hybrid environments: * ios, android, windows phone 8, windows 8. * if application supports other hybrid environments, see tutorial 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'); (var = 0; < 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 code give in sample app.
i unable recreate error.
make sure these steps you've taken:
- import mobilefirst platform studio 7.0 "invoking adapter procedures in hybrid applications" sample project
- right-click on adapter folder , select run > deploy mobilefirst adapter
- right-click on project folder , select new > mobilefirst environment, add ipad environment
- right-click on ipad folder , select run > xcode project
- click run in xcode
for me, following above steps able run sample application in ios simulator = app displayed , feeds retrieved.
Comments
Post a Comment