nsdictionary

How do I correctly use “openParentApplication” and “handleWatchKitExtensionRequest” so that “reply()” is called?

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Situation: I use openParentApplication in the Watch app to call handleWatchKitExtensionRequest in the main app. This works nicely in the simulator and it also works on the actual devices (Apple Watch and iPhone) when the iPhone app is active/open. Problem: When I run it on the actual devices (Apple Watch and iPhone), handleWatchKitExtensionRequest does not return data to openParentApplication when the main iPhone app is not active/open. Code in InterfaceController.m in the WatchKit Extension: NSDictionary *requst = @{ @"request" : @"getData"

Cocoa's NSDictionary: why are keys copied?

不羁的心 提交于 2019-12-03 01:28:47
All objects used as keys in NS(Mutable)Dictionaries must support the NSCopying protocol, and those objects are copied when they're used in the dictionary. I frequently want to use heavier weight objects as keys, simply to map one object to another. What I really mean when I do that is effectively: [dictionary setObject:someObject forKey:[NSValue valueWithPointer:keyObject]]; ("When I come back and hand you this same key object instance again, get me that same value out.") ...which is exactly what I end up doing to get around this design sometimes. (Yes, I know about NSMapTable in desktop Cocoa

iOS 8 Photos framework. Access photo metadata

匿名 (未验证) 提交于 2019-12-03 01:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm looking at replacing ALAssetsLibrary with Photos framework in my app. I can retrieve photos, collections, and asset sources just fine (even write them back out), but don't see anywhere to access the metadata of the photos (the dictionaries such as {Exif}, {TIFF}, {GPS}, etc...). ALAssetsLibrary has a way. UIImagePickerController has a way. Photos must have a way too. I see that PHAsset has a location property which will do for the GPS dictionary, but I'm looking to access all of the metadata which include faces, orientation, exposure,

AFNetworking returning NSCFData; issue with registerHTTPOperationClass [closed]

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am new to AFNetworking and am making a call to a simple login api that returns json like: { "status" : "success" , "data" :{ "auth_token" : "12jt34" }} I'm doing it via the following but it is returning __NSCFData rather than something that I can manipuate. NSURL * baseURL = [ NSURL URLWithString :@ "http://localhost:3000/arc/v1/api/" ]; AFHTTPClient * httpClient = [[ AFHTTPClient alloc ] initWithBaseURL : baseURL ]; [ httpClient registerHTTPOperationClass :[ AFJSONRequestOperation class ]]; [ httpClient defaultValueForHeader :@

How to Get the Display Name with the Display ID in Mac OS X?

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I was wondering if you could help me figure out how to progmatically get the Display Name for a monitor by using its Display ID number in Mac OS X (10.5)? A requirement is if I give a function the Display ID, it'll provide the Display Name in return (or vice versa). Display Name looks something like this: "Color LCD", "SAMSUNG" Display ID looks something like this: "69671872", "893830283" NSScreen in Cocoa (Obj-C), or CGGetActiveDisplayList in Quartz (C), allow you to get the Display ID number for a monitor. Neither appear to have a method

UINavigationBar change title text color and font size

匿名 (未验证) 提交于 2019-12-03 00:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to change navigation title's font and color..so, for that i've done this below code..but its not working... if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7")) { NSDictionary *navbarTitleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys: [UIColor whiteColor], NSForegroundColorAttributeName, [UIFont fontWithName:@"MyFavoriteFont" size:20.0], NSFontAttributeName, nil]; [[UINavigationBar appearance] setTitleTextAttributes:navbarTitleTextAttributes]; NSLog(@"setTitleTextAttributes"); } why this code is not working? 回答1: Apply

cocos2d-x3.17 lua 集成跳转到AppStore页面的功能

匿名 (未验证) 提交于 2019-12-03 00:40:02
开发环境: AppStoreInfo.h @interface AppStoreInfo : NSObject{ } + (void)openGradeInfo:(NSDictionary *)dict; //- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController; @end A ppStoreInfo.m #import "AppStoreInfo.h" #import <StoreKit/StoreKit.h> @implementation AppStoreInfo + (void)openInfo:(NSDictionary *)dict{ NSString *url = [dict valueForKey:@"url"]; NSLog(@"%@", url); [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url] options:@{} completionHandler:NULL]; } 文章来源: cocos2d-x3.17 lua 集成跳转到AppStore页面的功能

NSDecimalNumber

匿名 (未验证) 提交于 2019-12-03 00:22:01
#pragma mark- 创建一个十进位数字 /** * 创建一个十进位数字等同与给定的十进位结构 */ + (NSDecimalNumber *)decimalNumberWithDecimal:(NSDecimal)dcm; /** * 创建并返回一个与参数指定的数字相等的十进制数 */ + (NSDecimalNumber *)decimalNumberWithMantissa:(unsigned long long )mantissa exponent:( short )exponent isNegative:(BOOL)flag; /** * 创建并返回一个与参数指定的数字相等的十进制数 */ + (NSDecimalNumber *)decimalNumberWithString:(NSString *)numberValue; /** * 创建并返回一个与参数指定的数字相等的十进制数 * param locale locale代表一种格式,就像date的格式化一样。这里的locale可以传递两种格式 * eg //NSDictionary类型: NSDictionary *locale = [NSDictionary dictionaryWithObject:@"," forKey:NSLocaleDecimalSeparator]; //以","当做小数点格式 /

iOS 视图渲染数据转CVPixelBuffer

匿名 (未验证) 提交于 2019-12-02 23:55:01
void *pxdata = CVPixelBufferGetBaseAddress(pxbuffer); - ( CVPixelBufferRef ) CVPixelBufferRef { CGSize size = self . frame . size ; NSDictionary * options = @{( NSString *) kCVPixelBufferCGImageCompatibilityKey : @YES , ( NSString *) kCVPixelBufferCGBitmapContextCompatibilityKey : @YES , ( NSString *) kCVPixelBufferIOSurfacePropertiesKey : [ NSDictionary dictionary ]}; CVPixelBufferRef pxbuffer = NULL ; CGFloat frameWidth = size . width ; CGFloat frameHeight = size . height ; CVReturn status = CVPixelBufferCreate ( kCFAllocatorDefault , frameWidth , frameHeight , kCVPixelFormatType_32ARGB , (

displaying JSON data with the help of dictionaries and array

不想你离开。 提交于 2019-12-02 23:19:04
问题 I get the following error [__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x75a8e20 2013-04-20 08:56:14.90 MyApp[407:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x75a8e20' This is my first hands on working with JSON. I get the above mentioned error when I try to run the first piece of code where URL is a flickr url. When I use the photos as key it