6
votes

I am trying to draw svg maps using code generated through paintcode. The code is working fine when I am running it using simulator. But If I run it in device (iPad), it is crashing in drawCanvas method giving

Warning : Could not load any Objective-C class information. This will significantly reduce the quality of type information available.

Warning Screen Shot

Click here to check the warning Screen Shot

I am drawing map in storyboard where in view there is a scrollview and inside that one image View. I have added one StyleKitClass object (StyleKitClass is an NSObject class generated using PaintCode app) with which I connected via IBOutlet Collections to imageView.

Outlet Connections

Click here to view Outlet Connections

If anyone knows then please help me with the solution.

3
That warning is not the cause for crash. It’s just a message from debugger. Could you try to enable Address Sanitizer and run the code again? - Tricertops
I enabled Address Sanitizer. But it is not printing anything in the console. Also, when I print memory history with the memory address, it is not giving any value. - PriyaJain
But I found one thing at the time of warning in + (void)drawCanvas1 and that is, in the variable view the address for styleKit class is self=(class)0x0. It seems that that the StyleKit is deallocated. - PriyaJain
Never seen this issue before. Looks like the crash occurs before this method starts, so self contains some random value (0x20 on your screenshot). Are you using ARC? Did you modify generated code? Try calling this method from different place to see what happens. - Tricertops
No I haven't modified the code generated. I just dragged StyleKit classes in my project and started using as explained in the tutorials. Also, I am not using ARC. I will try calling the method from different place. - PriyaJain

3 Answers

6
votes

I work at PixelCut, we make PaintCode.

After you sent us the project I was able to confirm this issue by running on iPhone 5s. Unfortunatelly, you are pushing PaintCode, Xcode and iOS to their functional limits by trying to use drawing method with 53 thousand lines of code. This single method takes 9 MB in the binary (arm64 only, -Onone) and uses almost 1000 variables of pointer type. My best guess it that the app reaches some limits of stack memory size and is terminated by system.

We have seen StyleKits with more than 10 thousand lines before, but none of them had a single method this large. I would recommend to split your drawing into several canvases and compose them using Symbols, but I’m afraid that working with such huge drawing may be painfully slow.

0
votes

This happened to me recently, was caused by a mistyped file name on code of ViewController.swift.

0
votes

Try putting @objc in front of the functions used, like so:

@objc func myFunction() {

More on objective C interoperability here: https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithObjective-CAPIs.html