您的位置:首页 > 其它

欢迎使用CSDN-markdown编辑器

2015-11-11 09:00 232 查看
问题1: 2 duplicate symbols for architecture x86_64

这说的是工程中有两个重名的文件, 需要去掉一个文件. 比如说:

duplicate symbol OBJC_METACLASS$_YRJGrabDiscountCollectionViewCell in:

/Users/dllo/Library/Developer/Xcode/DerivedData/TravelAroundTheWorld-gdxyfbhvcwlgpvatyglixsuhfcfl/Build/Intermediates/TravelAroundTheWorld.build/Debug-iphonesimulator/TravelAroundTheWorld.build/Objects-normal/x86_64/YRJGrabDiscountCollectionViewCell-305F54B4D586F5A0.o

/Users/dllo/Library/Developer/Xcode/DerivedData/TravelAroundTheWorld-gdxyfbhvcwlgpvatyglixsuhfcfl/Build/Intermediates/TravelAroundTheWorld.build/Debug-iphonesimulator/TravelAroundTheWorld.build/Objects-normal/x86_64/YRJGrabDiscountCollectionViewCell-410B5CF1AE2DE970.o

duplicate symbol OBJC_CLASS$_YRJGrabDiscountCollectionViewCell in:

/Users/dllo/Library/Developer/Xcode/DerivedData/TravelAroundTheWorld-gdxyfbhvcwlgpvatyglixsuhfcfl/Build/Intermediates/TravelAroundTheWorld.build/Debug-iphonesimulator/TravelAroundTheWorld.build/Objects-normal/x86_64/YRJGrabDiscountCollectionViewCell-305F54B4D586F5A0.o

/Users/dllo/Library/Developer/Xcode/DerivedData/TravelAroundTheWorld-gdxyfbhvcwlgpvatyglixsuhfcfl/Build/Intermediates/TravelAroundTheWorld.build/Debug-iphonesimulator/TravelAroundTheWorld.build/Objects-normal/x86_64/YRJGrabDiscountCollectionViewCell-410B5CF1AE2DE970.o

ld: 2 duplicate symbols for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决方法: 将YRJGrabDiscountCollectionViewCell粘贴到Xcode的左下方的搜索栏中所搜, 找到不需要的然后删除.

问题2: 在给一个带字典属性或者数组的Model写成员变量的时候, 记住不要将数组或者数组设置为可变的, 要设置为不可变. 设为可变的会导致程序crash

问题3: 当程序中用到手势的时候, 切记第一步是打开用户交互, 不然添加的手势无效

问题4: 当我们在tableView中有多种不同的自定义cell的时候, 我们再设置cell的重用标志的时候, 一定不能重复, 不然会造成混乱从而导致程序crash.

问题5: Property follows Cocoa naming convention for returning “owned” objects.

解决方法: 一定要注意命名规范,不能以alloc,new,copy,mutableCopy 作为开头命名,比如:newPassword

问题6:当在给tableView的分区上添加一个视图的时候, 创建View的时候用了alloc,不要利用release进行内存释放, 因为需要返回View视图, 说明View视图还需要继续使用, 如果直接release的话, 会导致程序crash, 所有我们是使用autorelease来进行释放, 用完之后它会自己出了自动释放池释放.

想真机调试, 工程中需要创建修改测试证书和描述文件

buddle ID 工程的唯一标示

self.forAllButton = [UIButton buttonWithType:UIButtonTypeSystem];

self.forAllButton.frame = CGRectMake(0, 0, 100, 30);

[self.view addSubview:self.forAllButton];

[_forAllButton release];

特别注意以下代码:(不要在创建button后对其进行内存管理, release或者autorelease,都会导致程序crash)

self.forAllButton = [UIButton buttonWithType:UIButtonTypeSystem];

self.forAllButton.frame = CGRectMake(0, 0, 100, 30);

[self.view addSubview:self.forAllButton];

[_forAllButton release];

注意对象的释放时间, 如果在后面还要使用, 就不要太早的释放, 过早释放导致crash
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: