Page 1 of 1
IOS error code -10
Posted: Thu Sep 14, 2017 11:30 pm
by stevec
Where are the meanings of IOS error codes?
Re: IOS error code -10
Posted: Fri Sep 15, 2017 7:59 am
by tsupartono
They are described inside a file in the SDK (you won't have this unless you are developing using Apple SDK).
Is this error something you experienced?
Can you provide more details about the error?
Please provide any relevant screenshots and client log.
Re: IOS error code -10
Posted: Fri Sep 15, 2017 11:18 pm
by stevec
Getting it sometimes (not always) on save_image after a pop over message is displayed then click somewhere to make it go away then save
Adter this is run
When (= Email)
#COM_OWNER.IsNewForm := False
Fetch Fields(#CMEMAL #Cmname) From_File(CUSTMAST) With_Key(#Cmcust)
If Cond(#COM_OWNER.SharedStates<MobileApp> = Concentral)
#COM_OWNER.Get_SharedState Variablename('CC_User') Value(#CUUSRNAM)
Fetch Fields(#CUFNAME #CULNAME #CUEMAIL) From_File(WCUSUSR) With_Key(#CUUSRNAM)
Else
#COM_OWNER.Get_SharedState Variablename('UserID') Value(#UIUSER)
Fetch Fields(#UIFNAM #UILNAM #UIEMAIL) From_File(USRINFO) With_Key(#UIUSER)
#CUFNAME := #Uifnam
#CULNAME := #UILNAM
#CUEMAIL := #UIEMAIL
Endif
#CSSUTILITY.uSendEmail Subject('Your purchase contract is attached') Body('Thank you for your business!' + #COM_OWNER.LineFeed + #COM_OWNER.LineFeed + *COMPANY_NAME.trim) Fromname(#CUFNAME + ' ' + #CULNAME) Fromemail(#CUEMAIL) Toname(#Cmname) Toemail(#CMEMAL) Attachmentpath(('/LANSA_' + *LANSAPGMLIB.trim + '/webserver/images/PDF/' + #Filename)) O_Retc(#RET_CODE) Attachedfilename(#Filename)
Set_Ref Com(#PopOver) To(*create_as #LrPopMsg)
If Cond(#RET_CODE = OK)
Set Com(#PopOver) Uoverelement(PDFVIEWER) Umessagetext('Email has been sent to: ' + #cmemal) Umessagetype('C') Utype(Webview)
Else
Set Com(#PopOver) Uoverelement(PDFVIEWER) Umessagetext('Error trying to send email to: ' + #cmemal) Umessagetype('E') Utype(Webview)
Endif
#PopOver.uShow
then user clicks somewhere to remopve the message above and clicks save
When (= Save)
#COM_OWNER.IsNewForm := False
#DF_ELFNAM := 'POSC_' + #Cmcont.asstring + '_Signature.jpg'
#Com_Owner.Save_Image Name(Signature) Filename(*PART_DIR_EXECUTE + #DF_ELFNAM) Result(#Result)
* Inform the user about the result of the save of the photo
If Cond(*Not *SavedOk)
Set_Ref Com(#PopOver) To(*create_as #LrPopMsg)
Set Com(#PopOver) Uoverelement(Signature) Umessagetext('There was a problem saving this image! The iOS error code returned is: ' + #Result.AsString) Umessagetype('E') Utype(Image)
#PopOver.uShow
Else
Re: IOS error code -10
Posted: Tue Sep 19, 2017 11:00 am
by jasonzhou
This error code should mean that the element name doesn't not exist.
I've just done some test on this. When I specify an image element name that doesn't exist, I will get error code -10.
For example:
I defined an image element with name "ADDIMAGE"
Code: Select all
#Com_Owner.Set_Image Blankimageresource('Attach_Photo_Here.png') Name(ADDIMAGE) Newimage_Resize_Wdth(600) Newimage_Resize_Hght(450)
In Save action, I specified another name "ADDIMAGE2"
Code: Select all
When (= Save)
#COM_OWNER.IsNewForm := False
#Com_Owner.Save_Image Name(ADDIMAGE2) Filename(*PART_DIR_EXECUTE + 'myimage.png') Result(#Result)
Then I got -10 from #Result.AsString
Moreover, this error code is platform independent, it's not from iOS client, I think it would happen as well on Android, so it's better to remove "iOS" in the message text of popover.
Set Com(#PopOver) Uoverelement(Signature) Umessagetext('There was a problem saving this image! The iOS error code returned is: ' + #Result.AsString) Umessagetype('E') Utype(Image)
Re: IOS error code -10
Posted: Tue Sep 19, 2017 8:31 pm
by tsupartono
The error code -10 can also mean that the image element you specified in your
Save_Image call did not send any
image data at the time you make your
Save_Image call.
I think what happened is that you are calling the
Save_Image too late.
The LR client sends the image data to the server at the
first post to the server after the end-user made any changes to the
Image element (e.g. take a picture).
Subsequent posts do
not resend the image data to the server again (unless the end-user made further changes to the picture) - this is to save bandwidth & upload time.
This means that your RDML code (for this particular screen) must always do the following:
- Check if the client sends any image data
- If so, save the image data (which can either be to a temporary file, to be committed later when the user executes the Save option)
Since you don't know when the LR client might send the image data, the above logic should always be executed (for this particular screen), not only when the SAVE action is executed.
To check if the image data is present (assuming your image element is called SIGNATURE), use the
CheckProperty method:
Code: Select all
If (#Com_Owner.CheckProperty( '/Form.Fields.SIGNATURE.Image' ))
#FileName := *PART_DIR_EXECUTE + #LRNGSERVICES.GenerateUUID + '.png'
#Com_Self.Save_Image Name(SIGNATURE) Filename(#FileName) Result(#Result)
Endif
So what happened in your case, is that your first post after the end-user takes a picture does not immediately invoke
Save_Image (instead it's displaying a popover). During the subsequent post when the user pressed the save button, you invoked Save_Image - but by then it's too late as the image data was sent at the previous post already.
Re: IOS error code -10
Posted: Thu Sep 21, 2017 9:36 am
by stevec
We do not save data until the user clicks "save", they may not want too. It is a signature btw. Sounds like I should treat the "email" pressed as cancel or not allow it until they save or cancel
Re: IOS error code -10
Posted: Thu Sep 21, 2017 10:08 am
by tsupartono
The simplest would be to disable other functionalities until the user saves the record.
But you can still save the signature in a temporary file (but not commit it to the database), and commit that when the user click the Save button.