For example, write const NSString* firstString = @"xxx";
NSString* secondString = @"yyyy";
[secondString isEqualToString:firstString];
There is a warning about sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers.
Workaround.
Change const NSString* firstString = @"xxx";
to NSString* const firstString = @"xxx";
Explanation: The former is equivalent to the pointer itself is not modifiable, the latter indicates that the content pointed to by the pointer is not modifiable, both serve to make firstString readable and unwritable only.
Read More:
- [Solved] sending const NSString * to parameter of type NSString * discards qualifiers
- [Solved] error: invalid operands of types ‘const char [6]‘ and ‘const char [6]‘ to binary ‘operator+‘
- [Solved] MindSpore Error: Data type conversion of ‘Parameter’ is not supporte
- [Solved] Loadrunner Error: with parameter delimiters is not a parameter.
- [Solved] C++ Error: terminate called after throwing an instance of ‘char const‘
- OpenCV(-206:Bad flag (parameter or structure field)) Unrecognized or unsupported array type [How to Solve]
- Libtorch Error: Expected object of type Variable but found type CUDALongType for argument #2 ‘index’
- [Solved] ERROR_POLICY: attempt to perform an operation not allowed by the security policy `PDF‘ @ error/const
- [Solved] The method getContextPath() from the type HttpServletRequest refers to the missing type String
- [GNS3 router and cloud times error] error while sending commadn ‘bridge add_nio_ethernet
- How to Fix error: conversion from “” to non-scalar type “”
- [Solved] Arm Server kibana7.4.1 Error: Sending Logstash logs to /home/logstash-6.8.4/logs which is now configured via log4j2.properties
- [Solved] Error: In the Function of ‘fmt::v8::detail::error_handler::on_error(char const*)’
- How to Solve setsupportactionbar parameter Error
- [Solved] C + + compile Error: error: default argument given for parameter 3
- maven Error: Element ‘dependency’ cannot have character [children], because the type’s content type is
- MFC:: error C2065: “IDD_DIALOG1”: undeclared identifier Sending and handling custom messages in MFC threads
- [Solved] Error while extracting response for type [] and content type []…
- How to Solve Error: Element ‘dependency’ cannot have character [children], because the type’s content type is element-
- [Solved] Compilation error: dereferencing pointer to incomplete type…