For example, I wrote
const NSString* firstString = @”xxx”;
NSString* secondString = @”yyy”;
[secondString isEqualToString:firstString];
The sending ‘const nsstring *’ to parameter of type ‘nsstring *’ discards qualifiers warning appears.
Solution:
Set const nsstring * firststring = @ “XXX”;
Change to nsstring * const firststring = @ “XXX”;
Explanation: the former means that the pointer itself is not modifiable, while the latter means that the content pointed to by the pointer is not modifiable. Both functions are to make the firststring only readable and not writable.
Read More:
- Sending ‘const NSString *’ to parameter of type ‘NSString *’ discards qualifiers [Solved]
- [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.
- OpenCV(-206:Bad flag (parameter or structure field)) Unrecognized or unsupported array type [How to Solve]
- [Solved] C++ Error: terminate called after throwing an instance of ‘char const‘
- Libtorch Error: Expected object of type Variable but found type CUDALongType for argument #2 ‘index’
- [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
- [Solved] ERROR_POLICY: attempt to perform an operation not allowed by the security policy `PDF‘ @ error/const
- 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] Compilation error: dereferencing pointer to incomplete type…
- [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
- How to Solve Error: Element ‘dependency’ cannot have character [children], because the type’s content type is element-
- [Solved] Error while extracting response for type [] and content type []…
- MFC:: error C2065: “IDD_DIALOG1”: undeclared identifier Sending and handling custom messages in MFC threads