hi guys.
have code
code:
nsmutablestring *urlstring = urltextfield.text;
and warning: incompatible pointer type initializing 'nsmutablestring *' expression of type 'nsstring *'
warning means , how fix it? note still run code , works should be.
you not copying string, pointer value. system recognizing trying assign pointer of of non-mutable string mutable string. doesn't make sense since if tried altering urlstring after assignment, you'd attempting alteration projectnametf.text.
can following casting rid of warning, isn't want.
code:
nsmutablestring *urlstring = (nsmutablestring* )projectnametf.text;
if plan manipulate urlstring, declaring mutable string suggests, should copy content of projectnametf.text urlstring variable. 1 of following 2 methods acceptable, depending on life of urlstring.
code:
nsmutablestring *urlstring = [nsstring stringwithstring: projectnametf.text]; // non-retained nsmutablestring *urlstring = [[nsstring alloc] initwithstring: projectnametf.text]; // retained
Forums iPhone, iPad, and iPod Touch iOS Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
No comments:
Post a Comment