草庐IT

GET_MEMFUN_CLASS

全部标签

ios objective-c : How to get NSURLSession to return Content-Length(http header) from server

我已经试过了HowtogetNSURLSessiontoreturnContent-Length(httpheader)fromserver.Objective-c,ios-(longlong)getContentLength{NSURLSessionConfiguration*config=[NSURLSessionConfigurationdefaultSessionConfiguration];NSURLSession*session=[NSURLSessionsessionWithConfiguration:config];NSMutableURLRequest*request

ios - 读取字典元素的预期方法在 "class"类型的对象上找不到

我正在尝试为Objective-C中的自定义类实现键控下标:这是我在标题中的内容:-(id)objectAtKeyedSubscript:(id)key;这就是我在实现中所拥有的:-(id)objectAtKeyedSubscript:(id)key{idresult=self.attributes[key];returnresult;}我是这样使用的:element[@"href"];我之前在哪里:[elementobjectForKey:@"href"];像这样实现objectForKey的地方:-(NSString*)objectForKey:(NSString*)theKey{

iOS:覆盖子类中父类(super class)的setter属性

我需要在我的子类中覆盖父类(superclass)的setter父类(superclass):公共(public)接口(interface):@property(weak,nonatomic)UIView*mediaView;实现:-(void)setMediaView:(UIView*)mediaView{//somecode}子类:实现:-(void)setMediaView:(UIView*)mediaView{//somecode_mediaView=mediaView;---ERROR:Useofundeclaredidentifier'_mediaView'//someco

objective-c - 如何处理 '[<__NSCFString 0x2f1730> valueForUndefinedKey:]: this class is not key value coding-compliant for the key $oid' 错误

我遇到了错误(在主题中说明),因为有时属性“id”不会在返回的json中存储包含“$oid”的散列。例如有时我得到:"id":{"$oid":"4eea972209f47a0028000140"}有时我得到"id":"4eea972209f47a0028000140"我正在尝试检查以下代码以解决此类不规则问题if([[questionvalueForKey:@"id"]valueForKey:@"$oid"]){question_id=[[questionvalueForKey:@"id"]valueForKey:@"$oid"];}else{question_id=[question

iOS : Why can't I get mapkit to display a custom annotation pin image?

认为使用我自己的自定义图钉图像进行注释会非常容易。但我一直无法让它工作,我也不知道为什么!我只是在使用:-(MKAnnotationView*)mapView:(MKMapView*)mapViewviewForAnnotation:(id)annotation{if([annotationisKindOfClass:[MKUserLocationclass]])returnnil;NSString*annotationIdentifier=@"CustomViewAnnotation";CustomAnnotationView*customAnnotationView=(Custom

c++ - 对象 C 错误 : "expected unqualified-id before class pointer"

我目前正在从事iOS开发项目。为了方便起见,我在早期将功能拆分为几个小程序。该项目由Obj-C、Obj-C++和C++程序组成。现在,我将它们全部整合到最终产品中,并在(我猜)Obj-C和C++之间的兼容性方面遇到了一些奇怪的行为。我正在尝试在obj-C++程序中初始化一个来自obj-C类的对象。但是在编译obj-C类头文件时我总是报错:#import@classAVAssetExportSession;@interfaceLibraryImport:NSObject{AVAssetExportSession*export;//ErrorlineNSError*movieFileErr

objective-c - Objective-C : Get Substring between Double Quotes

获取双引号之间的每个子字符串并将其放入数组的最佳方法是什么?例如,如果字符串(NSString)是:@"abcd\"efgh\"ijklm\"no\"p\"qrst\"uvwx\"y\"z"我想要的结果是:{@"efgh",@"no",@"qrst",@"y"}作为一个NSArray。 最佳答案 这应该让你开始:NSString*str=@"abcd\"efgh\"ijklm\"no\"p\"qrst\"uvwx\"y\"z";NSMutableArray*target=[NSMutableArrayarray];NSScanner

ios - NSPredicate isKindOfClass 仅适用于 [myObject class] 不适用于 [MyClass class]

为什么[MyClassclass]无法在谓词中找到我想要的类的对象,而[myObjectclass]有效?请参阅下面的代码示例。我希望能够在一个集合中找到类型为MyClass的对象,而无需使用该类的虚假实例。MyClass*myObject=[[MyClassalloc]init];这行不通...NSPredicate*predicate=[NSPredicatepredicateWithFormat:@"selfisMemberOfClass:%@",[MyClassclass]];NSArray*predicateResults=[mySetfilteredSetUsingPred

ios - 架构 i386 的 undefined symbol : "_OBJC_CLASS_$_Barcode", 引用自:objc-class-ref in

我正在尝试将二维码生成库集成到我的应用程序中。QR生成器库是:https://github.com/kuapay/iOS-QR-Code-Generator我想我一定是把它整合错了,因为我收到了这个错误:Undefinedsymbolsforarchitecturei386:"_OBJC_CLASS_$_Barcode",referencedfrom:objc-class-refinQRViewController.old:symbol(s)notfoundforarchitecturei386clang:error:linkercommandfailedwithexitcode1(u

ios - 如何从 URL 中删除查询(用于 GET 参数)?

我正在构建一个小型REST服务来授权用户访问我的应用。有一次,我用来授权用户的UIWebView将转到https://myautholink.com/login.php.此页面发送带有授权token的JSON响应。关于这个页面的事情是它通过我的授权表格通过GET接收一些数据。我无法使用PHPsession,因为您通过以下方式到达此页面:header("location:https://myautholink.com/login.php?user_id=1&machine_id=machine_id&machine_name=machine_name&app_id=app_id");由于