Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXC_BAD_INSTRUCTION in drawContentWithPath when generating PDF - Simulator 16.4 and 17.0 #17

Open
matchos24 opened this issue Sep 28, 2023 · 1 comment

Comments

@matchos24
Copy link

Hi all,

I am using your framework ios-PDFexporter in the iPad app for generating PDF files from the UIViews and I am getting an error "Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)" when generating PDF file. The error makes the app unable to generate the PDF...
The strange is, I am getting this error only on Simulator since iOS version 16.4. I have tested it with iOS versions 16.4 and 17.0 and both versions of the simulator are getting this error.
iOS version 16.2 of the simulator (and all the previous versions) is working fine and the PDF can be correctly generated. Could you please help? Attached you can see the screenshot of the affected code and error:

Screenshot 2023-09-28 at 14 01 55

The exact Simulator I am using is iPad Pro (12.9-inch) (6th generation).

When I encountered this error on iOS 16.4 simulator for the first time, I just thought it's an issue of the simulator...But since I am getting the same error with other versions, I think the problem is related to your framework itself.

Note: When using the physical iPad for generating the PDF files instead of the simulator, it works fine and the PDF can be generated.

Any help would be much appreciated.
Thank you very much!

Best regards,
Matus

@david-livadaru-3pillarglobal
Copy link
Contributor

david-livadaru-3pillarglobal commented Sep 28, 2023

Hi @matchos24,

I started this work as a side project to be integrated in a larger project (as you are probably doing).
This framework was "no longer funded", it's currently years behind and won't be maintained; I know there were lots of slicing issues and as I see, others do encounter slicing in some cases.

My personal opinion is that this framework should be written in Swift and leave the Objective-C version it as is it.
Since you need it, start one. 😉

As I said, I haven't seen the code in years, but I try to help you with some ideas:

  1. Check that the object this method is called upon is actually an instance of UIView.
  2. Make sure that you have a context to draw upon.
  3. Make sure that there no nil objects.
  4. Check for changes in drawing methods since the release of the framework.
  5. If make a Swift version of this framework is not and option and you need to do changes to the framework, prefer either Project in Project configuration in Xcode or use a local path for Carthage; it's a lot easier than CocoaPods.

I hope it will be helpful!

Best of luck,
David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants