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

IBDesignable crash because of Animator #1336

Closed

Conversation

lunalugo25
Copy link

I create a subclass of LineChartView and this subclass is loaded in a IBDesignable UIView (CustomView), so when I add a UIView on a StoryBoard and subclass from my CustomView it crash because it's not capable to create '_displayLink'.

adamnemecek and others added 4 commits June 28, 2016 17:59


Process:               IBDesignablesAgentCocoaTouch [94019]
Path:                  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/IBDesignablesAgentCocoaTouch
Identifier:            IBDesignablesAgentCocoaTouch
Version:               7.3 (10085)
Code Type:             X86-64 (Native)
Parent Process:        Xcode [91085]
Responsible:           IBDesignablesAgentCocoaTouch [94019]
User ID:               503

Date/Time:             2016-08-18 17:41:10.752 -0500
OS Version:            Mac OS X 10.11.6 (15G31)
Report Version:        11
Anonymous UUID:        6D088489-76EE-8877-44B3-BDF36CFC1155


Time Awake Since Boot: 31000 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
CoreSimulator 209.19 - Device: IBSimDeviceTypeiPad1x - Runtime: iOS 9.3 (13E230) - DeviceType: IBSimDeviceTypeiPad1x
fatal error: unexpectedly found nil while unwrapping an Optional value
 

Thread 0 Crashed:
0   libswiftCore.dylib            	0x000000021b6a6108 _TTSf4s_s_d_d___TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su_T_ + 40
1   org.cocoapods.Charts          	0x0000000219b11311 _TFC6Charts13ChartAnimator7animatefT13xAxisDurationSd6easingGSqFT7elapsedSd8durationSd_V12CoreGraphics7CGFloat__T_ + 721 (ChartAnimator.swift:265)
2   org.cocoapods.Charts          	0x0000000219b1170c _TFC6Charts13ChartAnimator7animatefT13xAxisDurationSd12easingOptionOS_17ChartEasingOption_T_ + 156 (ChartAnimator.swift:277)
3   org.cocoapods.Charts          	0x0000000219b11851 _TFC6Charts13ChartAnimator7animatefT13xAxisDurationSd_T_ + 65 (ChartAnimator.swift:285)
4   org.cocoapods.Charts          	0x0000000219b6d525 _TFC6Charts13ChartViewBase7animatefT13xAxisDurationSd_T_ + 149 (ChartViewBase.swift:668)
I create a subclass of LineChartView and this subclass is loaded in a IBDesignable UIView (CustomView), so when I add a UIView on a StoryBoard and subclass from my CustomView it crash because it's not capable to create '_displayLink'.

-----------------------------------------------------------------------
Process:               IBDesignablesAgentCocoaTouch [94019]
Path:                  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/IBDesignablesAgentCocoaTouch
Identifier:            IBDesignablesAgentCocoaTouch
Version:               7.3 (10085)
Code Type:             X86-64 (Native)
Parent Process:        Xcode [91085]
Responsible:           IBDesignablesAgentCocoaTouch [94019]
User ID:               503

Date/Time:             2016-08-18 17:41:10.752 -0500
OS Version:            Mac OS X 10.11.6 (15G31)
Report Version:        11
Anonymous UUID:        6D088489-76EE-8877-44B3-BDF36CFC1155


Time Awake Since Boot: 31000 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
CoreSimulator 209.19 - Device: IBSimDeviceTypeiPad1x - Runtime: iOS 9.3 (13E230) - DeviceType: IBSimDeviceTypeiPad1x
fatal error: unexpectedly found nil while unwrapping an Optional value
 

Thread 0 Crashed:
0   libswiftCore.dylib            	0x000000021b6a6108 _TTSf4s_s_d_d___TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su_T_ + 40
1   org.cocoapods.Charts          	0x0000000219b11311 _TFC6Charts13ChartAnimator7animatefT13xAxisDurationSd6easingGSqFT7elapsedSd8durationSd_V12CoreGraphics7CGFloat__T_ + 721 (ChartAnimator.swift:265)
2   org.cocoapods.Charts          	0x0000000219b1170c _TFC6Charts13ChartAnimator7animatefT13xAxisDurationSd12easingOptionOS_17ChartEasingOption_T_ + 156 (ChartAnimator.swift:277)
3   org.cocoapods.Charts          	0x0000000219b11851 _TFC6Charts13ChartAnimator7animatefT13xAxisDurationSd_T_ + 65 (ChartAnimator.swift:285)
4   org.cocoapods.Charts          	0x0000000219b6d525 _TFC6Charts13ChartViewBase7animatefT13xAxisDurationSd_T_ + 149 (ChartViewBase.swift:668)
@liuxuan30
Copy link
Member

well, are you saying it's about swift 2.3 issue? I saw you want to merge into 2.3, but I'm not sure which part the issue resides on

@danielgindi
Copy link
Collaborator

This PR does not really describe what the changes are, and it contains various commits - not by the author of the PR.
If you want to create a PR, please create one against the latest master, with clean and clear code...

@danielgindi
Copy link
Collaborator

Oh I think I get it

danielgindi added a commit that referenced this pull request Aug 22, 2016
_displayLink might not have been created, i.e. in Interface Builder context.
@lunalugo25
Copy link
Author

Yes, danielgindib that was the issue

liuxuan30 added a commit that referenced this pull request Sep 1, 2016
migrate Chart v3 code in master to swift 2.3 syntax (#1387)

* upgrade carthage to 0.17.1

* use master commit for iso-snapshot-test-case for now. once the fix is tagged we could change to the new version

* change Rakefile, comment out tvOS because no FBSnapshotTestCase

* Add missing imports for iOS 7 support

* Update ChartSelectionDetail.swift

* BUGFIX: fix infinite recursive call of getXIndex(_:)

* for #1208, seems drawBarShadowEnabled should be false by default

* 1. update ios-snapshot-test-case to 2.1.2
2. remove brew upgrade carthage, because travis saying

* improve descriptions to warn users how to use setVisibleRange APIs

* Typo fix

* upgrade Realm to 1.0.2

* update Realm pod spec to 1.0.2

* fix pod spec typo

* Work on x-values instead of x-indices (free for all :-)

* Improvement for pie slice spacing calculation

* Example improvements

* Docs improvements

* Major work on highlights

* ChartMarker is now a protocol, and we have ChartMarkerView/Image helpers

* Improvements regarding irrelevant inherited methods

* Added feature to change color of "no data" text

* More work on highlights

* Viewport enhancements for better horizontal bar support

* X-axis renderer enhancements for better horizontal bar support

* Minor improvement to valueFormatter

* Completed copy routine for scatter dataset

* Pie: Renamed `drawSliceTextEnabled` to `drawEntryLabelsEnabled`

* Pie: Added feature to offset center text

* Pie: Separate color/font for entry labels (defaults to value color/font)

* Minor improvements to demo

* Minor refactoring of variable names

* Example cleanup

* Refactored scatter shape rendering into interface and renderers

* Improved docs

* Removed deprecated --var / var--

* Update README.md

* Dropped iOS 7.0 support from README (Closes #601)

* Fixed a RadarChart bug where value labels were misplaced

* Realm fixes

* Improvements to zoom methods

* Legend improvements

* DRYed some code

* Adjusted maxHighlightDistance defaults

* Removed NaN check for highlight.

* Cleanup these comments

* `drawBarShadowEnabled` is working again

* Do not invalidate here by default, like other zoom methods

* Simplified scatter shape enum model

* These return a single pixel (x/y), for values (x value and y value)

* Renamed x-pos to x-value where appropriate

* Renamed ChartMarker -> IChartMarker

* Namespace `Marker` names only for Objc (Swift 2.2)

The Charts v3 changes are a chance to do this,
  as it's a breaking change anyway.

* Do not force unwrap here

* Fix for comments

* More improvements to Markers, default behaviour constraint to view size

* Docs

* The highlight breaking changes are a chance to use @objc(name) feature

* Use @objc(name) feature for rarely used classes (by users)

* Improved entryIndex rounding method

* Fixed drawing bounds for some of the charts

* Removed unused yValueForXValue / yValuesForXValue

* Set a default shape renderer

* Take the correct barData object here

* Fixed combined chart highlight with bar data

* Minor refactoring

* Removed the extra offset that messed up legend location

* Cache XBounds object

* Breaking change: `valueFormatter` now accepts an IValueFormatter

This allows for formatting depending on viewport state etc.

* Avoid x values in Pie's calcMinMax

* This workaround is not required in the newer compilers

* Renamed formatter interfaces

FillFormatter -> IFillFormatter
ValueFormatter -> IValueFormatter
AxisValueFormatter -> IAxisValueFormatter

* Avoid truncating using Int(...), it overflows

* Corrected formula for 29-feb :-)

* Some minor bug fixes for formatters

* Polished demos

* More improvements to examples

* These should be internal

* Fixed xAxis min/max calculation typo

* Added helper to generate a fill formatter with a closure (block)

* Added more samples

* Updated tests

* Set default barWidth to match old default behaviour

* Renamed axisMinValue/axisMaxValue to axisMinimum/axisMaximum

* Cleaned up header comments

(I know that most of these files were created by me, I don't need that
 in the headers...)

* Removed deprecated startAtZero properties

* When only one of scaleXEnabled or scaleYEnabled is effective

* Docs

* Cleanup

* Use EPSILON instead of an arbitrary value (Fixes #1239)

* Fix dataset update in Dual line chart demo (Fixes #1250)

* Add half line width to clipping rect of grid/limit lines (Fixes #1204)

* Simplified legend entries configuration. Option to style dataset form.

(Closes #1282)

* Added feature for dashing legend line forms

* Change default formLineWidth to match the default on MPAndroidChart

* neededWidth should be enough here. formSize has no meaning globally.

If more offset is needed - use extraOffsets, or adjust the maxSizePercent).

* Renamed those classes too. Cleaner now. Should be too breaking...

As with swift's minimal syntax - the chance of anyone referencing
  those by name is very low.
On ObjC, the names stayed the same, for namespacing.

* Take care of edge cases when calculating intervals (labelCount == 0)

* autoScaleMinMax is working again (Fixes #1209)

* Minor refactoring (Closes #1187)

Sorry, un-mergable to `master`...

* Fixed reversed condition from cbd7bf7

* It's clearer this way

* Fill before stroke - because the fill may cover half of a thick stroke

(Closes #982)

* Added those new classes to tvOS/macOS targets

* Migrated viewFromXib to macOS

* Call `print` under `Swift` namespace, due to Cocoa ambiguity in NSView

* Migrated macOS demos to Charts 3.0

* Use an optional for _displayLink (Fixes #1336)

_displayLink might not have been created, i.e. in Interface Builder context.

* Corrected LineChartRenderer cubicFill x range

* Fixed horizontal cubic calculation bug introduced when removing x-index

* Avoid using deprecated property in demo

* Updated test screenshots

* Animating the wrong axis for the starting point

* migrate Chart v3 code in master to swift 2.3 syntax
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

Successfully merging this pull request may close these issues.

4 participants