cancel
Showing results for 
Search instead for 
Did you mean: 

Offline Data Caching Native iOS

Former Member
0 Kudos

Hi, guy

I am working on Offline Data SMP 3.0, i am saved Service Document and MetaData in cache already but, when turn off internet connection, I will read service document and metadata in cache but i can not get service document schema and metadata schema because entityType in service document and metadata are null, Please suggest me how to read service document and metadata in Cache on Offline Mode or give me some example.

Thank you

Accepted Solutions (0)

Answers (2)

Answers (2)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Would you like to update your query post if you have found the solution?

Rgrds,

JK

Former Member
0 Kudos

Yes, I would

midhun_vp
Active Contributor
0 Kudos

You have to leverage cache library to store the service document and metadata document. My expert area is not IOS, I have a sample code for Android. Given below is an example :


IODataServiceDocument serviceDocument = null;

try {

//Getting Service Document from the cache

serviceDocument =

(IODataServiceDocument)mApplication.getCache().readDocument(

DocumentType.ServiceDocument,

FlightModelConstants.FLIGHT_MODEL_SERVICE_DOCUMENT);

} catch (CacheException e) {

Log.v(TAG, e.getLocalizedMessage());

}

//Checking if Service Document was not found in cache,

if (serviceDocument == null) {

mProgress =

ProgressDialog.show(this,

(CharSequence) "",

(CharSequence)

getString(R.string.serviceDocumentProgress),

true);

mRequestTag = REQUEST_SERVICE_DOCUMENT;

//Preparing request to retrieve Service Document from the server

IRequest request =

RequestBuilder.getInstance().buildServiceDocumentRequest(this,

REQUEST_SERVICE_DOCUMENT);

//Sending the request

mApplication.getRequestManager().makeRequest(request);

} else {

Toast.makeText(this, R.string.msgServiceDocumentCache,

Toast.LENGTH_LONG).show();

//Service Document was in the cache, now we are going to retrieve the

Schema

this.getServiceSchema();

}

The APIs are given in bold letters. Hope that helps.

Code to be added in onSuccess callback method to store the document:

IODataServiceDocument serviceDocument = parser

.parseODataServiceDocument(responseString);

mApplication.getCache().storeDocument(serviceDocument,

DocumentType.ServiceDocument,

FlightModelConstants.FLIGHT_MODEL_SERVICE_DOCUMENT);

Former Member
0 Kudos

Thank you so much

In iOS code is same step but i don't know why is null only EntryTypes but everything is not null, i thing in code cannot reference ID.