iOS 笔记-incompatible pointer types initializing 'NSMutableString *' with an expression of type 'NSString *'警告处理

记录下来,以防止再犯错

代码如下

NSString *userHeader = [userInfoDictionary objectForKey:@"photo"];
    NSMutableString *mutableuserHeader = [NSMutableString stringWithString:userHeader];
    //设置用户头像
    NSRange range = [mutableuserHeader rangeOfString:@".."];
    [mutableuserHeader replaceCharactersInRange:range withString:@"video"];
    NSMutableString *userHeaderInfo = [Port stringByAppendingString:mutableuserHeader];

红色字体部分出现的题目中的警告,经查实解决办法是把

NSMutableString换成
NSString这样问题便迎刃而解~

iOS 笔记-incompatible pointer types initializing 'NSMutableString *' with an expression of type 'NSString *'警告处理

时间: 2024-10-29 19:09:56

iOS 笔记-incompatible pointer types initializing 'NSMutableString *' with an expression of type 'NSString *'警告处理的相关文章

Incompatible pointer types assiging to "UIViewController" *_Nullable' from 'AppDelegate*'

Incompatible pointer types assiging to "UIViewController" *_Nullable' from 'AppDelegate*' 本人遇到此问题的情况:在AppDelegate.h中判断版本号时,进行跳转引导页或主控制器. self.window.rootViewController =[self initRootVc];//注意此处不能调用以init开头的方法,要改为其他名字 eg:[self firstVc]: //调用此方法返回一

incompatible pointer types assigning to 'nsmutablearray ' from 'nsarray '

这是因为NSMutableArray和NSArray不是同一个类型造成的. 解决方法 // NSArray --> NSMutableArray NSMutableArray *myMutableArray = [myArray mutableCopy]; // NSMutableArray --> NSArray NSArray *myArray = [myMutableArray copy]; incompatible pointer types assigning to 'nsmutab

iOS笔记:Objective-C自定义NSLog宏

/*  XCode LLVM XXX - Preprocessing中Debug会添加 DEBUG=1 标志  */ #ifdef DEBUG #define NSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORM

学习ios笔记第一天的C语言学习记录

c语言基础学习 int num1 = 15; int num2 = 5; int temp = 0; //先把num1放到temp里 temp = num1; //先把num2放到num1里 num1 = num2; //先把temp放到num2里 num2 = temp; 算数运算符 +加法运算 -减法运算符 *乘法运算符 /除法运算符  ------整型相除取整,除数不为0 %取余运算符 ------两边均为整数 ++递增运算-------运算符在前,先执行:运算符在后,后执行: --递减运

IOS Exception 1(libc++abi.dylib: terminating with uncaught exception of type NSException)

2014-08-05 22:18:46.455 SwiftUI[1329:40871] -[_TtC7SwiftUI14MViewControler clickMe]: unrecognized selector sent to instance 0x10ea15dc0 2014-08-05 22:18:46.458 SwiftUI[1329:40871] *** Terminating app due to uncaught exception 'NSInvalidArgumentExcept

IOS App发布问题:code signing is required for product type "Application" in SDK 'iOS 9.2'

问题: 解决: 如果从ituns connect上download的profile,双击后project下的code signing还是没有profile,手动添加. 如果还是不行,从xcode的preference下进入account ????? ? 从provisioning profiles中下载需要的profile(原先的没用的全部删除) 检查 a. Aichive的配置为distribution 检查b. project和target的build setting下的code signi

【IOS笔记】Creating Custom Content View Controllers

Creating Custom Content View Controllers 自定义内容视图控制器 Custom content view controllers are the heart of your app. You use them to present your app’s unique content. All apps need at least one custom content view controller. Complex apps divide the workl

【IOS笔记】Views

Views Because view objects are the main way your application interacts with the user, they have many responsibilities. Here are just a few: 通过view对象是与用户交互的主要方式,它们有很多责任,下面是其中一些: Layout and subview management   布局 A view defines its own default resizin

【IOS笔记】Gesture Recognizers

Gesture Recognizers Gesture recognizers convert low-level event handling code into higher-level actions. They are objects that you attach to a view, which allows the view to respond to actions the way a control does. Gesture recognizers interpret tou