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

Save picture crash in demos on iOS 11+ #3311

Closed
Ferdzz opened this issue Mar 1, 2018 · 9 comments · Fixed by #3312
Closed

Save picture crash in demos on iOS 11+ #3311

Ferdzz opened this issue Mar 1, 2018 · 9 comments · Fixed by #3312

Comments

@Ferdzz
Copy link

Ferdzz commented Mar 1, 2018

As of iOS 11, Apple requires developers to declare the use of write-only photos action. Otherwise the app crashes when trying to save a pictures.

This is an issue on the ChartsDemo apps.

Steps to reproduce

  • Open the ChartsDemo-Swift app
  • Open the Bar Chart view
  • Press on Options
  • Select Save to Camera Roll
  • Notice the app crashes

Environment

Tested on iPhone 8 Plus 11.1 simulator.
I had the same issue happen to me on physical devices too.

Crash log

2018-03-01 14:07:45.963707-0500 ChartsDemo-Swift[60661:893072] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data.
Message from debugger: Terminated due to signal 9

Fix

Fixing this is quite simple. Just add the following lines to the Info.plist

<key>NSPhotoLibraryAddUsageDescription</key>
<string>Reason why you need this permission</string>
@liuxuan30 liuxuan30 added the bug label Mar 2, 2018
@liuxuan30
Copy link
Member

image
I checked, the info.plist seems already have the key.
Why crash then?

@liuxuan30
Copy link
Member

I just tried on my phone, it works expected, asking for permit, and once you allow it it will save to camera roll.

@liuxuan30 liuxuan30 removed the bug label Mar 2, 2018
@Ferdzz
Copy link
Author

Ferdzz commented Mar 2, 2018

Hi @liuxuan30

I don't believe this bug was fixed. What is currently in the Info.plist is the NSPhotoLibraryUsageDescription key. Not the NSPhotoLibraryAddUsageDescription key. They are both different. On iOS 10 and prior, NSPhotoLibraryUsageDescription will be enough for iOS to open a permission request to the user, but not on iOS 11. Is your phone running iOS 11?

This is still crashing on simulators. I'll be more than happy to open a pull request to fix this if you reopen the issue

@liuxuan30
Copy link
Member

I remember it's 10.2 system. Not tested on 11 yet.
I will try find one and test again now.
This should be a quick fix if what you said is true. I can fix it in another PR

@liuxuan30
Copy link
Member

Thanks for reporting!

@Ferdzz
Copy link
Author

Ferdzz commented Mar 3, 2018

My pleasure! We're really pleased with your library, used on a couple commercial projects and I'm glad to see it's actively supported :)

If I had some questions on displaying more custom controls / labels where would it be appropriate to ask that?

@liuxuan30
Copy link
Member

Glad to hear that :) Though the author has been inactive for quite a long time, we are lucky to have some collaborators working on it, though slowly.
General usage questions you are welcome to ask on Stack Overflow.
But for enhancements/new features, you can post here.
For advanced customizations, I'm not sure, but you can ask here I think.

Asking on SO can reduce our Github inbox size, so we can focus on something else.

FreddyZeng added a commit to FreddyZeng/Charts that referenced this issue Mar 11, 2018
FreddyZeng added a commit to FreddyZeng/Charts that referenced this issue Mar 14, 2018
* master: (55 commits)
  Refactors -[tableView:cellForRowAtIndexPath:] (ChartsOrg#3326)
  fix ChartsOrg#3311. Need one more key for iOS 11 camera roll saving
  revert a mistake, fix ChartsOrg#3299
  add pie chart unit tests (ChartsOrg#3297)
  ChartsOrg#3287: align Objc and Swift demos balloon marker
  update changelog
  Min and Max reset when clearing ChartDataSet (Fixes ChartsOrg#3260)
  Restored old performance (ChartsOrg#3216)
  Support other bundle than main MarkerView.viewFromXib() (ChartsOrg#3215)
  For ChartsOrg#2840. add dataIndex parameter in `highlightValue()` calls (ChartsOrg#2852)
  Balloon Marker indicates position of data (ChartsOrg#3181)
  bump Info.plist version
  Fixed a duplicated assignment compared with obj-c code. (ChartsOrg#3179)
  Updated README for 3.0.5 (ChartsOrg#3183)
  BubbleChart uses correct colour for index now.
  Added custom text alignment for noData
  Fixes the distance issue between the legend and the horizontal bar chart (Fixes ChartsOrg#2138) (ChartsOrg#2214)
  call setNeedsDisplay() here to trigger render noDataText (ChartsOrg#3198)
  添加定制TY的Mark
  添加修改过的Mark到工程中
  ...

# Conflicts:
#	ICXCharts.podspec
@MHamayun
Copy link

liuxuan30

Great Answer Work for me......

@MHamayun
Copy link

I remember it's 10.2 system. Not tested on 11 yet.
I will try find one and test again now.
This should be a quick fix if what you said is true. I can fix it in another PR

Great Answer Work for me......

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 a pull request may close this issue.

3 participants