草庐IT

EXTERNAL_PROPERTY

全部标签

objective-c - 潜在泄漏,将 NSString-Property 分配给 UILabel

当我分析我的代码时,当我将核心数据字符串属性分配给UILabel时,它显示出潜在的泄漏cell.textLabel.text=prop.new_value;使用Instrument和Leaks运行应用程序没有显示任何问题。 最佳答案 静态分析器理解某些Cocoa约定,例如以“new”开头的方法返回一个保留的对象指针。我建议将prop.new_value中的“new_value”更改为不同的内容。来源:http://clang.llvm.org/docs/AutomaticReferenceCounting.html#objects.

ios - 如果我正在创建完全自定义的 getter 和 setter 方法,我还需要 @property 声明吗?

所以我想在一个类上有一个“属性”,但我不想只将该属性保存在内存中,我想实际将其存储为NSUserDefault并在您获得该属性时检索它。因此我有这样的方法:-(void)setUser:(User*)user{//actuallysettheuserasanNSUserDefaulthere}-(User*)user{//gettheuserfromtheNSUserDefaultsandreturnit}当我构建这些方法来为我完成工作时,在头文件中声明@property有什么意义吗?我收到的消息很复杂。有人说你应该声明属性以强制人们使用getter/setter方法,但我不明白为什么

ios - 更新到下一个 Xcode 得到编译器警告 Auto property synthesis will not synthesize property

自更新Xcode以来,我收到了这个新警告:自动属性合成不会合成属性“标题”;它将由其父类(superclass)实现,使用@dynamic来确认意图。这是为了@property(strong,nonatomic)NSString*title;在我已经子类化的UIViewController中。有谁知道此警告的含义以及我如何摆脱它?谢谢 最佳答案 UIViewController已经有一个propertycalledtitle可读/写。您的同名自定义属性预示着它。然后编译器会引发此错误,就好像您正在重新声明访问器方法(而不是使用@dy

ios - MvvmCross Xamarin.iOS 绑定(bind) : How does MVVM cross know what property to bind against?

所以我一直在试验MvvmCross,我遇到了以下创建绑定(bind)的语法:this.CreateBinding(GenerositySlider).To((TipViewModelvm)=>vm.Generosity).Apply();在该代码示例中,GenerositySlider是iOS中的UISlider。我知道我可以使用For方法指定要绑定(bind)的特定属性。但是这段代码有效,并且框架知道绑定(bind)UISlider上的Value属性。MvvmCross如何知道绑定(bind)UISlider上的Value属性?如果它默认为各种控件的特定值,是否有关于它将默认为什么属

javascript - react native 导航器 : Cannot read property 'push' of undefined

所以我在玩ReactNative,在我的第一个Navigator成功之后,我制作了另一个Navigator来路由到另一个页面。这是我的文件结构:项目-机器人/-备份/-ios/-节点模块/-来源/--购买.js--聊天.js--main.js--nargo.ios.js--样式.js-index.android.js/-index.ios.js/-介绍.js/-main.js/-package.json/这是我的-index.ios.js:importReact,{Component}from'react';import{AppRegistry,}from'react-native';

javascript - 类型错误 : Cannot read property 'receiptnumber' of undefined in react native

我的组件有这些属性constructor(props){super(props);this._onPress=this._onPress.bind(this);this.state={receiptnumber:"",text:"",time:"",isDateTimePickerVisible:false};}我已经在执行良好的按钮的点击事件上绑定(bind)了_onPress方法。我正在_onPress方法中调用另一个方法_saveScheduleMessage,我试图访问this.state.receiptnumber我收到错误。_onPress(){try{if(Platfor

ios - 使用@property ivars 的最佳实践

有人可以分享一些关于在init方法或指定初始化程序中使用@propertyiVars的最佳实践/代码约定的知识吗?请看我的例子:@interfaceMyClass()@property(nonatomic,strong)nsstring*tempString;@property(nonatomic,strong)NSMutableArray*arrItems;@end@implementationViewController-(id)init{if(self=[superinit]){//Isthisbestpractice/correct_tempString=@"";_arrIte

ios - 来自带有 Mantle : ignore a property 的 JSON 的对象

我的应用程序从JSON创建一些ObJC对象。一切正常,直到我向我的ObjC模型类添加了一个新属性,该属性在JSON中没有对应项。我已经按如下方式配置了映射:+(NSDictionary*)JSONKeyPathsByPropertyKey{return@{@"firstName":@"firstname",@"middleName":@"middlename",@"lastName":@"lastname",//etc.@"phoneNumber":NSNull.null//noJSONdataforthisone};}但是我在Mantle中遇到断言失败,在MTLJSONAdapter

ios - StoreKit验证错误 21002 : The data in the receipt-data property was malformed

在iPhone4/iOS4设备上,沙盒AppStore在验证期间报告此错误:21002:Thedatainthereceipt-datapropertywasmalformed.在iPhone5/iOS6设备上,相同的代码可以正常工作(状态==0,收据已返回),没有任何问题。我重新启动了设备,确保AppleID已注销,甚至创建了一个新的测试用户帐户。同样的结果。有什么想法吗? 最佳答案 此错误表示您为验证而创建的JSON对象格式不正确。{"receipt-data":"(receiptbyteshere)"}所以我的建议是在iPho

ios - @property 在幕后实际上做了什么......使用 self.和 self-> 和 _ 下划线

我仍在为@implementation部分的语法错误而苦苦挣扎。所以,我想了解使用和不使用@property之间的区别。第一种情况是一个@interface,我在{}中声明了一些变量。//ViewController.h#import#import"Student.h"//justclassimade@interfaceViewController:UIViewController{Student*stObj;}而且,我正在尝试使用多个标识符(_(下划线)、self.、self->、无)来引用stObj指针//ViewController.m#import"ViewController