Xcode编译错误和警告汇总(持续更新中)

Error:Cannotassignto'self'outsideofamethodintheinitfamily

mysolution:

如果你的方法是一个初始化方法,则方法名必须用“init”开始,或者,你也可以把方法改为一个类方法,返回一个单例对象,我的问题方法如下:

-(id)initwithPage:(unsigned)pageNum {...}
注意小写‘w’

我把它改为:

-(id)initwithPage:(unsigned)pageNum {...}
注意大写‘W’

我的问题就解决了。

Fromhttp://stackoverflow.com/questions/16013238/cannot-assign-to-self-out-of-a-method-in-the-init-family

Error:CouldnotloadNIBinbundlewithnameXXX

mysolution:

因为我是用Storyboard,但是却用ViewController的方法加载,所以出错了,改为:

UIStoryboard *sboard = [UIStoryboard storyboardWithName:@"StoryboardFileName" bundle:nil];
YourViewController *vc1 = [sboard instantiateInitialViewController];
问题解决.

Fromhttp://stackoverflow.com/questions/12443385/could-not-load-nib-in-bundle-with-name-secondviewcontroller/12443395#12443395

Error:Terminatingappduetouncaughtexception'NSUnknownKeyException',reason:'[<ViewController0x7d90880>setValue:forUndefinedKey:]:thisclassisnotkeyvaluecoding-compliantforthekeycurrentTime.'

mysolution:

选中'currentTime'控件所在的storyboard(或nib),点击'currentTime'控件,storeboard左侧的ViewControllerScene中的对应控件也会选中,在Scene选中控件中右键弹出窗口查找删除无效的ReferencingOutlets连接,问题解决,

Fromhttp://stackoverflow.com/questions/5932397/the-class-is-not-key-value-coding-compliant-for-the-key

Error:-[__NSArrayIisEqualToString:]:unrecognizedselectorsenttoinstance0x7d1b3c0

Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'-[__NSArrayIisEqualToString:]:unrecognizedselectorsenttoinstance0x7d1b3c0'

mysolution:

原来是我把NSMutableDictionary错写成NSMutableArray,包括相应的方法调用,改过来就好了,

Fromhttp://stackoverflow.com/questions/17377190/assigning-values-in-nsarrays

Error:Avalidprovisioningprofilematchingtheapplication'sIdentifier''couldnotbefound

mysolution:

IhadthesameerrormessagewhenIwastryingtobuildanapponmyiPhone.Everythingseemedtobeinorder,I.e.thecertificateswereallvalidandpresentandsoon,butIjustcouldn'tgetittowork.

Ijustcouldn'tfindtheoption"iOSteamprovisioningprofile"inProject>BuildSettings>CodeSigning>CodeSigningIdentity-thiswasthemaincluetoasolution.Ifyoucan'tseethatoptionthere,checkyourXcodeOrganizer.

Insideit,gotoLibrary>ProvisioningProfiles:

Xcode编译错误和警告汇总(持续更新中)

Nowwhatyoushouldseeifeverythingwererightisthis:

Xcode编译错误和警告汇总(持续更新中)

Butifontheotherhandyouseeanemptylist,clicktheRefreshbuttoninthelowerrightcorneroftheOrganizer:

Xcode编译错误和警告汇总(持续更新中)

Aftersaidprocedure,Xcodestartedchurningoutwonderfulmessagesof"adding"and"finishing"andthenmyappappearedonmyiPhone.TheEnd.

Goodluck!

Fromhttp://stackoverflow.com/questions/11985611/a-valid-provisioning-profile-matching-the-applications-identifier-could-not

相关推荐