Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Development and suggestions about third part tool integration.
Cordova, Xamarin, Basic4Android topics are listed here.
  • Page:
  • 1

TOPIC:

Cordova iOS app crash with local PDF 8 years 5 months ago #11107

  • phillip_plum
  • phillip_plum's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Hello,
we are using the cordova Plugin. When I open a remote PDF, everything is fine. But when i try to load a PDF from the filesystem, I get every time this error:

2016-08-31 15:30:50.993 OstfriesischerKurier[509:52877] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x21ed9b0b 0x21696dff 0x21dea6d3 0x1273dd 0x11dbf1 0x11defd 0x2653becb 0x2454e325 0x24537b23 0x2462c79d 0x24536fdb 0x2451af0d 0x2451abc5 0x2451a081 0x24519d55 0x264a67f5 0x21e9b2b1 0x21e995a7 0x21e999e5 0x21de81c9 0x21de7fbd 0x23404af9 0x2651c435 0x103a13 0x21a94873)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

Please Log in or Create an account to join the conversation.

Cordova iOS app crash with local PDF 8 years 5 months ago #11108

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

can you share the slice of code used to open the local file? the method searches into Documents folder, so the file must be located there (or in a subfolder).

Please Log in or Create an account to join the conversation.

Cordova iOS app crash with local PDF 8 years 5 months ago #11109

  • phillip_plum
  • phillip_plum's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Hi,
i use this code:
RadaeePDFPlugin.open({
	url: "epapers/"+ePaper.id+".pdf"
	},
	function(message) {
		console.log("Success: ");
		console.log(message);
	},
	function(err){
		console.log("Failure: ");
		console.log(err);
	});

When i use the "wrong" url i get a error but when i use the "right" url the app crashed. With the same PDF, but on a server it works.

Please Log in or Create an account to join the conversation.

Cordova iOS app crash with local PDF 8 years 5 months ago #11110

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
If you have to open a file located in documents folder, you have to use "file://" before the file name/file path: url: "file://epapers/"+ePaper.id+".pdf"
if you have to open a file from assets, you can use openFromAssets method, in this case you can use directly the file name.

Please Log in or Create an account to join the conversation.

Cordova iOS app crash with local PDF 8 years 5 months ago #11124

  • phillip_plum
  • phillip_plum's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Perfect! Thanks, now it works fine.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum