0

We have recently updated Xcode & Cordova and made some changes on our app. Every time when i hit the "Generate PDF"-button the UIDocumentActivityViewController shows up. Now when you click on iBooks or any other app listed, the app crashes/freezes.

2015-11-04 13:40:48.987 Foo-App[405:31201] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
2015-11-04 13:40:54.350 Foo-App[405:31201] Creating pdf from html has been started.
2015-11-04 13:40:54.357 Foo-App[405:31201] Creating pdf from html has been started.
2015-11-04 13:40:54.421 Foo-App[405:31201] Html2Pdf webViewDidFinishLoad
2015-11-04 13:40:54.444 Foo-App[405:31201] HTMLtoPDF did succeed (file:/var/mobile/Containers/Data/Application/B9F83B50-4201-44D4-A01B-549C5017BC15/Documents/Ihr-Haus.pdf)
2015-11-04 13:40:58.804 Foo-App[405:31201] Html2Pdf webViewDidFinishLoad
2015-11-04 13:40:58.847 Foo-App[405:31201] HTMLtoPDF did succeed (file:/var/mobile/Containers/Data/Application/B9F83B50-4201-44D4-A01B-549C5017BC15/Documents/Ihr-Haus.pdf)
2015-11-04 13:40:58.883 Foo-App[405:31201] Attempt to present <_UIDocumentActivityViewController: 0x18413000> on <MainViewController: 0x17db5e70> which is waiting for a delayed presention of <MFMailComposeViewController: 0x18b01400> to complete
2015-11-04 13:40:59.456 Foo-App[405:31201] Warning: Attempt to present <MFMailComposeViewController: 0x18b01400>  on <MainViewController: 0x17db5e70> which is already presenting <_UIDocumentActivityViewController: 0x18b5a800>
Process 405 stopped
* thread #1: tid = 0x79e1, 0x366cfc84 libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x366cfc84 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x366cfc84 <+8>:  blo    0x366cfc9c                ; <+32>
    0x366cfc88 <+12>: ldr    r12, [pc, #0x4]           ; <+24>
    0x366cfc8c <+16>: ldr    r12, [pc, r12]
    0x366cfc90 <+20>: b      0x366cfc98                ; <+28>  

What happened? Before the update everything went well. Any help would be super! Greets

EDIT:

This is where we call the html2pdf to create a pdf

// create PDF and send by e-mail
window.html2pdf.create(
    sgs.mailBody,
    "~/Documents/Ihr-Haus.pdf",
    //cordova.file.documentsDirectory."Ihr-Haus.pdf",
    // success
    function(status) {
        cordova.plugins.email.open({
            subject: 'Your PDF',
            attachments: [
                "~/Documents/Ihr-Haus.pdf"
            //cordova.file.documentsDirectory."Ihr-Haus.pdf"
            ],
            body: sgs.mailBody,
            isHTML: true
        });
        console.log('success',status);
    },
    // error
    function(status) {
        console.log('fail',status);
    }
);

UPDATE 25.11 After i've uninstalled the email-composer plugin and removed all the lines i got this new error:

015-11-25 12:25:27.299 Konfigurator[6189:1204820] Html2Pdf webViewDidFinishLoad
2015-11-25 12:25:27.345 Konfigurator[6189:1204820] HTMLtoPDF did succeed (/var/mobile/Containers/Data/Application/F3E4B450-251D-4C1E-A9C1-8530302F2A9E/Documents/Ihr-Haus.pdf)
2015-11-25 12:25:27.351 Konfigurator[6189:1204820] Warning: Attempt to present <_UIDocumentActivityViewController: 0x18bb7c00>  on <MainViewController: 0x16e7e4d0> which is already presenting <_UIDocumentActivityViewController: 0x17436e00>
2015-11-25 12:25:39.883 Konfigurator[6189:1204820] *** Assertion failure in -[_UIOpenWithAppActivity performActivity], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.29.5/UIDocumentInteractionController.m:408
igurator[6189:1204820] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController has gone away prematurely!'
*** First throw call stack:
8c9 0x28c905bb 0x28781efd 0x287851a1 0x28569107 0x28477a55 0x28477531 0x2847742b 0x27d075cf 0x365d7e1b 0x365dc6c9 0x242cb535 0x242c9a2f 0x2421c0d9 0x2421becd 0x2d3d6af9 0x284a52dd 0x6ab33 0x36600873)
type NSException
Process 6189 stopped
* thread #1: tid = 0x126254, 0x366cfc84 libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
   frame #0: 0x366cfc84 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x366cfc84 <+8>:  blo    0x366cfc9c                ; <+32>
   0x366cfc88 <+12>: ldr    r12, [pc, #0x4]           ; <+24>
   0x366cfc8c <+16>: ldr    r12, [pc, r12]
   0x366cfc90 <+20>: b      0x366cfc98                ; <+28>
moeses
  • 497
  • 1
  • 6
  • 21
  • can you provide your code to generate PDF or the plugin you are using? – jcesarmobile Nov 24 '15 at 09:12
  • this is the plugin which creates the pdf: at.modalog.cordova.plugin.html2pdf 1.0.0 "Html2pdf" – moeses Nov 24 '15 at 10:10
  • is this one https://github.com/moderna/cordova-plugin-html2pdf? can you provide your code too? – jcesarmobile Nov 24 '15 at 10:57
  • Yeah that's right! Sorry was in a meeting. please check out my edited post – moeses Nov 24 '15 at 12:01
  • try removing all the email part, there are some errors related to presenting the mail composer while the UIDocumentActivityViewController is present, and UIDocumentActivityViewController already has an option to send as email – jcesarmobile Nov 24 '15 at 13:37
  • Thank you @jcesarmobile for your help! Have to try it out tomorrow - i'm gonna report if it worked or not – moeses Nov 24 '15 at 17:22
  • @jcesarmobile hey take a look at my update! – moeses Nov 25 '15 at 11:29
  • I've just created a new cordova project (cordova CLI 5.4, cordova ios 3.9.2), added ios platform and the plugin from github url. Added this code in the deviceready event ```window.html2pdf.create(document.documentElement.outerHTML, "~/Documents/test.pdf", function(status) { }, function(status) {});``` and created a pdf with my html – jcesarmobile Nov 25 '15 at 12:21
  • i'm using the same versions like you and tried your code but it crashes with the same error-output like the one i've posted in my update from today. – moeses Nov 25 '15 at 14:14
  • Make sure you are not calling the window.html2pdf.create twice, I could reproduce your problem calling twice. The Warning: Attempt to present <_UIDocumentActivityViewController: 0x18bb7c00> on which is already presenting <_UIDocumentActivityViewController: 0x17436e00> says you are trying to present a new UIDocumentActivityViewController over an existing one – jcesarmobile Nov 25 '15 at 14:19
  • So i ran a console.log and when i push the "create pdf" button the console shows exact one success message… mhh strange – moeses Nov 25 '15 at 14:36
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/96157/discussion-between-moesphemie-and-jcesarmobile). – moeses Nov 25 '15 at 14:39

0 Answers0