我对目标 c 基本上一无所知,但是我如何做一个 if 语句来查看 SourceTypeString 是等于 1 还是等于 2?
NSString* sourceTypeString = [arguments objectAtIndex:2];
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera; // default
NSLog(@"my ns string = %@",sourceTypeString);
//NEWBIE PART
if ((sourceTypeString == 1))
{
NSLog(@"equals 1");
sourceType = (UIImagePickerControllerSourceType)[sourceTypeString intValue];
} else {
NSLog(@"equals 2");
sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
//NEWBIE PART
我的代码崩溃并给了我
my ns string = 1
(lldb)
sourceTypeString __NSCFNumber * 0x0013bf80 (int)1