Xcode报错Expected selector for Objective-C and Expected method body

简介: Xcode报错Expected selector for Objective-C and Expected method body

1.先说个基本小错误:早上运行项目整个崩溃了,查找原因发现是把一个value为nil的参数存入了NSUserDefault,这个在使用时需要注意。


2.来说说Expected selector for Objective-C method    and   Expected method body这个问题:

image.png

第一步我改好后运行项目发现了这个问题,网上很多都说是把里面的东西剪切出来再粘贴回去或者创建个新的文件粘贴进去,删除原来的,博主没试过,仅说明下,而博主遇到并不是这个原因,问题出在崩溃的main.m里面,原因是第一次崩溃的时候,不小心在里面加入了一条横线,如图:

1.png

图中已经圈出,很不明显,也不会在这里报错,诸位要注意了,类似的问题可能出现在别的地方,以此为鉴。

目录
相关文章
|
iOS开发
Xcode报错解决方法:ld: symbol(s) not found for architecture arm64
Xcode报错解决方法:ld: symbol(s) not found for architecture arm64
3247 0
|
3月前
|
iOS开发 MacOS Perl
解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘
解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘
138 4
|
3月前
|
iOS开发 Perl
解决Xcode15报错:DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS
解决Xcode15报错:DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS
157 1
|
3月前
|
iOS开发 Perl
解决Xcode报错Stored properties cannot be marked unavailable with ‘@available‘
解决Xcode报错Stored properties cannot be marked unavailable with ‘@available‘
46 0
|
6月前
|
iOS开发
Xcode报错“compact unwind compressed function offset doesn‘t fit in 24 bits
Xcode报错“compact unwind compressed function offset doesn‘t fit in 24 bits
63 1
|
iOS开发
Xcode运行报错The certificate used to sign “XXX” has either expired or has been revoked.解决办法
Xcode运行报错The certificate used to sign “XXX” has either expired or has been revoked.解决办法
250 0
|
iOS开发
Xcode运行报错Failed to prepare device for development.解决办法
Xcode运行报错Failed to prepare device for development.解决办法
665 0
|
开发者 iOS开发
Xcode运行报错The operation couldn’t be completed. Unable to launch xxx because it has an invalid code...
Xcode运行报错The operation couldn’t be completed. Unable to launch xxx because it has an invalid code...
896 0
|
API iOS开发
iOS 开发 - Xcode8下self.view.layer不能addSublayer,报错
iOS 开发 - Xcode8下self.view.layer不能addSublayer,报错
72 0
iOS 开发 - Xcode8下self.view.layer不能addSublayer,报错
|
iOS开发
Xcode报错"The working copy 'xxx' has uncommitted changes"解决方案
Xcode报错"The working copy 'xxx' has uncommitted changes"解决方案
102 0