草庐IT

variable-declaration

全部标签

iphone - iOS 瓶颈 : Global variable vs. 核心数据或属性列表

我是iOS和Cocoa的新手。我的问题不是关于如何让某些东西发挥作用,而是更多关于改善用户体验和性能的设计。我正在为现有应用程序添加功能。目前,该应用程序有一个类“RootViewController”(RVC),负责发出服务器请求。RVC调用服务器以获取json响应。这个json响应被解析,解析后的响应被一个名为“array”的NSArray对象引用。服务器提供给“阵列”的数据必须定期更新,因为它代表其他客户可以购买的实时库存。我需要在应用程序生命周期的不同时间在其他类中使用对“数组”的引用。我不想每次要使用或更新“数组”时都调用服务器。在我自己的设备上测试此应用时,调用服务器似乎很

微信小程序getLocation报错 getLocation:fail the api need to be declared in the requiredPrivateInfos field in

getLocation:failtheapineedtobedeclaredintherequiredPrivateInfosfieldinapp.json/ext.json微信小程序在使用wx.getLocation控制台报错:getLocation:failtheapineedtobedeclaredintherequiredPrivateInfosfieldinapp.json/ext.jsonwx.getLocation({type:'wgs84',success:res=>{constlatitude=res.latitude;constlongitude=res.longitude

ios - Xamarin 绑定(bind)类别返回错误 : cannot declare instance members in a static class

我正在尝试绑定(bind)ReFrostedViewController到c#。我使用ObjectiveSharpie来生成界面。但是当我使用Xamarin编译它时,它返回错误。/REFrostedViewController_UIViewController.g.cs(10,10):ErrorCS0708:`REFrostedMenu.REFrostedViewController_UIViewController.__mt_FrostedViewController_var':cannotdeclareinstancemembersinastaticclass(CS0708)(RE

IOS : Releasing variable with @property (nonatomic,保留)

带有@propertynonatomic和retain的变量是否应该显式释放。@interfaceMyScreenViewController:UIViewController{UIWebView*greetingView;}@property(nonatomic,retain)IBOutletUIWebView*greetingView;-(void)dealloc{[greetingViewrelease];}是否需要在delloc方法中发布??? 最佳答案 当然。是的,您应该通过保留、复制和不分配来释放您的属性(propert

Objective-C ARC __weak 变量引用触发警告 "__weak attribute cannot be specified on an automatic variable"

我有一个应用程序(仅限ios5),它在方法内声明了一个在block内使用的弱变量,以引用ViewController的实例。QRCodeViewController*__weakweakSelf=self;问题是编译器显示警告说:__weakattributecannotbespecifiedonanautomaticvariable在那个应用程序中我使用了很多弱引用而且我从来没有看到这样的警告,与其他类的唯一区别是这个类是在.mm文件中实现的,因为它使用c++对象并且项目可以如果我将其保留为.m,则编译。我必须说代码似乎工作正常。有什么建议吗? 最佳答案

iphone - ARC 语义问题 : No visible @interface for Class declares the selector

非常基本的东西,但我无法解决问题所在。在我的项目中,我有一个名为“TheFeedStore”的类,它具有以下两种方法:-(BOOL)hasItemBeenRead:(RSSItem*)item{............}-(void)markItemAsRead:(RSSItem*)item{.........}我正在使用以下类方法,以便其他类可以使用它访问这些方法:+(TheFeedStore*)sharedStore{staticTheFeedStore*feedStore=nil;if(!feedStore){feedStore=[[TheFeedStorealloc]init]

[USF-ModelSim-48] Failed to locate ‘vsim.exe‘ executable in the shell environment ‘PATH‘ variable.

vivado联合modelsim仿真时出现以下报错[USF-ModelSim-48]Failedtolocate'vsim.exe'executableintheshellenvironment'PATH'variable.Pleasesourcethesettingsscriptincludedwiththeinstallationandretrythisoperationagain. 解决方法有可能是这两个空了,重新关联一下就可以了 关联方法看这里vivado2019.1关联modelsim仿真

ios - Xcode 10 构建错误 : 'must declare at least one output file'

我正在尝试使用Xcode10构建一个有点复杂的应用程序,以便我可以很快将它提交到商店,但我收到以下错误(为简单起见更改了路径)。仅显示所有错误:-1:'/Uses/Desktop/ios/app/Vendor/QMServices/QMContactListCache/QMContactListCache/CoreData/QMContactListModel.xcdatamodeld'的shell脚本构建规则必须声明至少一个输出文件(在目标'QMContactListCache'中)我真的不知道这意味着什么,我什至不确定如何在项目中找到目标,因为我没有看到它。它在Xcode9中构建没

ios - 如何打印 "\u{variable}"之类的 Unicode?

例如,我可以像这样打印Unicode符号:println("\u{00A3}")//print"£"如果我想打印Unicode范围如“00A1到00A7”如何使用for循环打印?forvarcode=0x00A1;code这行不通 最佳答案 这个有效:forvarcode=0x00A1;code打印:¡¢英镑¤¥¦§ 关于ios-如何打印"\u{variable}"之类的Unicode?,我们在StackOverflow上找到一个类似的问题: https://

swift - swift 中各种类型的变量声明之间的区别

我很困惑何时以及如何在Swift中的特定点声明变量,这让像我这样的SWIFT新手很头疼。以下类型的声明有什么区别?我已经给出了我对它们的想法和理解。如果我错了,请用您的解决方案纠正我,并稍微解释一下,以便我知道实际和准确的答案。Array-1)vararr=NSArray()//IthinkitsaninstanceofimmutableNSArraytype2)vararr=NSMutableArray()3)vararr=Array()//IhavenoideaofdifferencebetweenNSArrayandArraytype.Mightbebotharesame4)va