Comments (16)
I am getting the same issue. Had you figured this one out yourself by any chance?
from chcsvparser.
I didn't really try to handle these warnings as they are harmless. I am also sure that this issue will be targeted by the project owner when he will get to it.
from chcsvparser.
I just checked and this warning doesn't occur with the HEAD version of CHCSVParser.
from chcsvparser.
Definitely still getting these warnings with the latest code on the master branch today. They are the only warnings in my project. It would be very nice to have them fixed.
from chcsvparser.
You're right. This is occurring with Xcode 7. A related warning with Xcode 6.4 was fixed by moving to HEAD.
from chcsvparser.
This SO link seems to explain what's causing the warning (http://stackoverflow.com/a/24565513/45813). If you are very concerned about removing the warnings your best option now is to suppress them:
In your project:
- Edit the build settings for your the CHCSVParser target.
- Search for "Other warning flags".
- Add -Wno-objc-designated-initializers
You could do turn it off on a per file basis as well as the link explains
from chcsvparser.
You can disable the warnings by a adding this at the top of your CHCSV.m and CHCSV.h files just before @interface.
#ifdef __IPHONE_8_0
// suppress these errors until we are ready to handle them
//#pragma message "Ignoring designated initializer warnings"
#pragma clang diagnostic ignored "-Wobjc-designated-initializers"
#else
// temporarily define an empty NS_DESIGNATED_INITIALIZER so we can use now,
// will be ready for iOS8 SDK
#define NS_DESIGNATED_INITIALIZER
#endif
from chcsvparser.
Dave has recently checked in changes to a 3.0.0 branch of this project. The 3.0.0 version is Swift-based and doesn't have this warning.
from chcsvparser.
I'm having this same issue on Xcode 7.2 . I'm on the latest objective c Branch.
Is there a way to solve this, other then suppress the warning?
thanks
from chcsvparser.
This warning appears since the designated initializer of the super class (NSObject > init) is not implemented in CHCSVParser and CHCSVWriter classes. The reason it's not implemented is that the library creator wished us the developers to use only the designated and convenience initializers defined in these classes.
In my own code I use the following approach in similar cases:
- In the h file, I am adding the following declaration:
- (instancetype)init NS_UNAVAILABLE;
-
In the m file, I am adding the following implementation:
-
(instancetype)init {
[NSException raise:NSInternalInconsistencyException format:@"Illegal call to designated initializer of super class (%@). Please call only initializers defined in this class!", NSStringFromSelector(_cmd)];
return nil;
}
This way, warnings are gone, calling to the init initializer will generate a compile time error, and getting somehow to the init initializer method bypassing the compiler error (maybe by dynamic dispatch) will generate a runtime exception.
Any thoughts?
from chcsvparser.
Hi yoasha,
I tried your implementation without success. a new warning says "Convenience initializer missing a 'self' call to another initializer"
thanks for helping
from chcsvparser.
It doesn't make a lot of sense... please try the following just to see what is wrong:
In the CHCSVParser.h remove the following code that I previously asked to add:
- (instancetype)init NS_UNAVAILABLE; from the h file and add
In the CHCSVParser.m, replace the code that I previously suggested with the following one:
- (instancetype)init {
return [self initWithCSVString:nil];
}
Let me know if there are any warnings for the CHCSVParser class
from chcsvparser.
Hi yoasha,
this solves one warning (@implementation
CHCSVParser)`
using the same idea I added
- (instancetype)init { return [self initForWritingToCSVFile:nil]; }
to solve the second warning @implemantation
CHCSVWriter
this way, the warnings are gone.
I like your idea to add some alert to avoid the programmer trying to initialize using init. Maybe returning nil. Xcode asks to call self anyway, so I ended with this.
`-(instancetype)init {
self = [self initForWritingToCSVFile:nil];
[NSException raise:NSInternalInconsistencyException format:@"Illegal call to designated initializer of super class (%@). Please call only initializers defined in this class!", NSStringFromSelector(_cmd)];
return nil;
}
`
thanks for helping
from chcsvparser.
Very interesting. In my code, I don't need to add the following line (just before the exception code) in order to prevent the warning:
[self initForWritingToCSVFile:nil];
Having just the NSException code did the work for me. I am not sure why, but maybe it's related to the warning level preferences in Xcode which might be different in our dev environments.
BTW, after adding your code to the implementation file that prevented the warnings, did you try to add again the following line to the h file?
- (instancetype)init NS_UNAVAILABLE;
This line should be very useful as it prevents calling this initializer at compile time rather than runtime.
from chcsvparser.
Hi yoasha,
good news! I didn't try before to just add - (instancetype)init NS_UNAVAILABLE;
into the h file. The good news is that it solves the warnings and avoid the use of init .
I asked this same question on stackoverflow http://stackoverflow.com/questions/38044609/chcsvparser-warnings-how-to-solve-this-one, without answer. Would you like to answer this question with the help you give me? My english is really poor, and you guide me find the right solution. I really thank you for helping so much.
from chcsvparser.
Hi, I'm glad this helped.
@davedelong (or any user with admin rights), what do you think about this solution? I can submit a pull request if you find this solution legit.
from chcsvparser.
Related Issues (20)
- Four warnings when I build. Xcode 7.3, targeting iOS 8 or later. HOT 4
- issue with (ΒΊ)degree symbol at time of export HOT 2
- When open a csv file in appending mode, set the _currentLine the last line number of the file
- Exception raised when using -writeLineWithDictionary: to append records
- Fails to parse line with backslashed quotes, even with 'recognize backslashes' option
- Swift delegate prototypes (a comment, not an issue) HOT 2
- Parsed Data Replaces Double Quotes with Two Sets of Double Quotes HOT 1
- unable to parse csv file with initWithContentsOfCSVFile HOT 1
- Fails to parse record with unescaped parenthesis HOT 10
- Parsing ends if field includes nullchar HOT 1
- Thoughts on providing SAX style parsing
- The parser doesn't see field when it contains unescaped '\n' HOT 1
- tvos support HOT 2
- NSInputStream inputStreamWithURL always nil HOT 1
- Using the 3.0.0 Version in Swift HOT 1
- Output parsing to an Array? HOT 1
- writeField:(id)field raises exception if first line of CSV has any null field HOT 1
- Typo in readme.markdown
- Use a proper CSV writer HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chcsvparser.