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

dataSource not available with xCode version 7.3 #269

Closed
declareerror opened this issue Mar 22, 2016 · 17 comments
Closed

dataSource not available with xCode version 7.3 #269

declareerror opened this issue Mar 22, 2016 · 17 comments
Assignees

Comments

@declareerror
Copy link

After updated xCode latest version (7.3). There is an error with core plot datasource.
(Previous version its worked.)

datasource not available

this is original
@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak id<CPTPlotDataSource> dataSource;
and i just remove __cpt_weak it worked.
@property (nonatomic, readwrite, cpt_weak_property) id<CPTPlotDataSource> dataSource;
i don't know can i remove __cpt_weak.
@eskroch

@eskroch
Copy link
Member

eskroch commented Mar 22, 2016

What version of Core Plot are you using? The latest version has this declaration:

 @property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak id<CPTPlotDataSource> dataSource;

Note cpt_weak vs. __cpt_weak.

@declareerror
Copy link
Author

coreplot 2.0 downloades from release

@euroboy
Copy link

euroboy commented Mar 22, 2016

Same problem. version 2.0, XCode 7.3

@declareerror
Copy link
Author

#if CPT_SDK_SUPPORTS_WEAK #define __cpt_weak #define cpt_weak_property weak #else #if __clang__ && (__clang_major__ >= 3) #define __cpt_weak __unsafe_unretained #else #define __cpt_weak #endif #define cpt_weak_property assign #endif

i modified your code with my code its worked. but i don't this is the best way to fix this problem.
and this is dataSource property
@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak id<CPTPlotDataSource> dataSource;
@eskroch

@eskroch
Copy link
Member

eskroch commented Mar 23, 2016

Make sure the app is pointed at the right headers. The 2.0 release has the new declaration (with out the leading underscores) I posted above. Is this iOS or Mac? Are you using the release package or building from source?

@declareerror
Copy link
Author

I used IOS version. using from release package. Still have an error.

Here is CPTDefinitions.h screen short.
screen shot 2016-03-23 at 08 37 20

Link binary in my project
screen shot 2016-03-23 at 08 36 40
Data source property
screen shot 2016-03-23 at 08 37 32
Build error
screen shot 2016-03-23 at 08 33 18

Do you have any ideas what wrong? Thank you.
@eskroch

@eskroch
Copy link
Member

eskroch commented Mar 23, 2016

The headers are right now. Where are those build errors? In your app? Make sure those files import the Core Plot headers (CorePlot-CocoaTouch.h).

@declareerror
Copy link
Author

I imported already.
screen shot 2016-03-23 at 09 16 07

There is no dataSource property when i try to access its.

screen shot 2016-03-23 at 09 17 57

My Xcode project created by appcelerator studio for create new module.
@eskroch

@malikmani
Copy link

I am also facing this issue 'dataSource is unavailable' due to the ARC is disabled in my Project.

So If change this original line (CPTDefiniations.h):
#define cpt_weak __weak
to:
#define cpt_weak
It compiled and worked fine.Is this the correct way to resolve this issue?

CorePlot v2.0 is currently been used in my project.

@eskroch
Copy link
Member

eskroch commented Mar 26, 2016

Weak properties require automatic reference counting. Turning on ARC in the files that reference any Core Plot weak properties will eliminate the error.

I know how, but I'm not sure if I can safely turn off the weak setting when compiling client apps without ARC. I need to research that further.

@eskroch
Copy link
Member

eskroch commented Mar 26, 2016

Research info: Mike Ash has a good overview of ARC.

@gyratorycircus
Copy link

At least for the dataSource property, it doesn’t look like the cpt_weak is serving a purpose. If the ivar were explicitly defined, then it would be necessary to prepend the ivar with a __weak to use with a weak property. But since its synthesized, the ivar will automatically be created as weak. Actually, Mike Ash also discusses this in the Properties section of the article. I've also never seen __weak used at that location in the property declaration -- is this allowed?

@eskroch
Copy link
Member

eskroch commented Mar 27, 2016

It may be redundant, but it's obviously allowed. Core Plot has been around a long time. cpt_weak may be a holdover from before we could use automatically synthesized ivars.

The big unanswered question I have is how does non-ARC client code deal with a weak property. Since Core Plot is compiled with ARC, these are zeroing weak references. Non-ARC code will see them as unsafe_unretained which is similar, except the compiler won't expect the automatic zeroing behavior which could cause problems in optimized code.

@gyratorycircus
Copy link

While it may be allowed, its redundant in the property declaration, and causing a compiler error. Removing the cpt_weak corrects the error and does not change the memory management of a property with a synthesized ivar.

@eskroch eskroch self-assigned this Mar 27, 2016
eskroch added a commit that referenced this issue Mar 27, 2016
…arations. It was redundant and caused problems with client code that does not use ARC. Fixed issue #269.
@eskroch eskroch closed this as completed Mar 27, 2016
@euroboy
Copy link

euroboy commented Mar 29, 2016

@eskroch I don't see this fix after installing Core Plot via CocoaPods (pod 'CorePlot', '~> 2.0').
How to get latests commits via pods? Thanks.

@iDevelopper
Copy link

Why some users like me does not issue this problem? Xcode 7.3 (pod 'CorePlot', '~> 2.0') too.

@eskroch
Copy link
Member

eskroch commented Mar 29, 2016

Use this line in the pod file to get the latest code from the Master branch:

pod 'CorePlot', :git => 'https://github.com/core-plot/core-plot.git'

panupat pushed a commit to Backelite/core-plot that referenced this issue Jun 16, 2016
beepscore added a commit to DiabetesCompass/Diabetes_Compass that referenced this issue Nov 4, 2016
TODO:
See if 1.6 fixes build error 'delegate' is unavailable CPTAnimationOperation

Consider update to 2.2, or replace CorePlot with WKWebView and javascript library like D3.js

core-plot/core-plot#269
shinjukunian pushed a commit to shinjukunian/core-plot that referenced this issue Jun 10, 2019
* commit '2e6b25210926cf12a8b72a3aba167efe5252d3a2':
  Removed the unused curvedLineGranularity property from CPTScatterPlot. Fixed issue core-plot#270.
  Removed the cpt_weak definition and removed it from all property declarations. It was redundant and caused problems with client code that does not use ARC. Fixed issue core-plot#269.
  Fixed a memory leak in CPTAnimation.
  Updated all scheme settings for Xcode 7.3.
  Added profiling app setting to the Mac Plot Gallery scheme.
  Fixed a type conversion warning in the Plot Gallery app.
  Fixed broken links on the Doxygen main page.
  Fixed a broken link in the README file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants