cancel
Showing results for 
Search instead for 
Did you mean: 

MDK app is being closed at execution of DownloadMedia in iOS

0 Kudos

Hello,

I'm trying to open image in offline mdk app, but the app is just closing whenever 'Download Media' action is being executed on iOS. But, it is working well on Android. I checked 'ClientLog.txt' file on device, but no error message is found. The image is already downloaded in offline store when offline is initialized.

Program is crashing below with DownloadImage.action(before Success Action - DocumentFileSave.js ) .

  } else if (mediaIsLocal) {
return pageProxy.executeAction("/WOOffline/Actions/DownloadImage.action");
} else {


Please find attached related source files.

Version: MDK: 6.1.0
iOS: 15.1 (tested with old version 14.8.1, but it is the same).

Since it is working well in Android and no error message is found in log file, I don't know how I can check further. Any guide would be very appreciated.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

While I don't have a solution at this time and agree it should not crash, as an alternative, did you know that MDK 6.1 supports direct OData image rendering? Instead of calling Download and saving the image to the local device you can just directly reference the image to simplify the process.

See the What's New in Mobile Development Kit client 6.1 blog for more details.

0 Kudos

Hi Bill,

I changed the code like below as you suggested with direct reference.

   } else if (mediaIsLocal) {
        //return pageProxy.executeAction("/WOOffline/Actions/DownloadImage.action");

        let path = "/WOOffline/Services/WorkOrder.service/" + readLink + "/$value";
	alert(path);
        
	return pageProxy.executeAction({
            "Name": "/WOOffline/Actions/OpenImage.action",
            "Path": path,
            "MimeType": "image/jpeg"
            })        
  } 

The variable 'path' shows like below and looks fine with alert function:

/WOOffline/Services/WorkOrder.service/ZWOAttachmentSet(Aufnr='4100003',FileName='4100003_20211202_101806_00033')/$value

It is not crashing, but not opening image and getting this error message below:

#2021-12-03 10:45:15:792 -0500: ERROR - (Main) - SAP.MDKClient - SharedLogger.swift.log(_:message:) - download OfflineOData error: Error: [-10133] A defining query with name "ZWorkOrderSet('4100003')" does not exist

I'm not sure why I'm getting this error message.

Here is the Object Table target definition on page:

	"_Type": "Section.Type.ObjectTable",
	"DataSubscriptions": [
		"ZWOAttachmentSet"
	],
	"Target": {
		"Service": "/WOOffline/Services/WorkOrder.service",
		"EntitySet": "{@odata.readLink}/OrderAttach",
		"QueryOptions": "$orderby=FileName",
		"ReadLink": ""
	},

Thanks.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

I was actually referring to the direct image rendering support where you just directly reference the OData image in the DetailImage property. If the media is already downloaded during initialization then no rules are required. Just point to the image.

"ObjectCell": {
    "Title": "{Name}",
    "Subhead": "{CategoryName}",
    "Footnote": "{DimensionWidth} {DimensionUnit} x {DimensionHeight} {DimensionUnit} x {DimensionDepth} {DimensionUnit}",
    "StatusText": "$(C,{Price},{CurrencyCode},'',{minimumIntegerDigits:1,minimumFractionDigits:0,maximumFractionDigits:2,useGrouping:true})",
    "SubstatusText": "{QuantityUnit}",
    "DetailImage": "/PersistentFilters/Services/SampleServiceV2.service/{@odata.readLink}/$value",
    "DetailImageIsCircular": false,
    "PreserveIconStackSpacing": false,
    "AccessoryType": "disclosureIndicator",
    "OnPress": "/PersistentFilters/Actions/Products/NavToProducts_Detail.action"
},
0 Kudos

Hi Bill,

It is working using both DetailImage in Object Cell and Path in OpenDocument now.


Thanks for your help.

0 Kudos

Hi Bill,

When I open document with direct refence of odata image, the page header shows 'path' value. Is there a way to override the value?

Thanks.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Not at this time. I will check with the team about either blanking it out for direct rendered items and/or exposing a caption property in the future.

0 Kudos

Thanks for your help, Bill. Hope we can have that option in near future!

Answers (0)