objective-c

Unique identifier for peripheral BLE device

折月煮酒 提交于 2021-02-06 11:23:29
问题 So I have peripheral BLE device and I need some identifier for it to later share with another iPhone. Example I connect with iPhone 'A' to peripheral. iPhone 'A' saves peripheral's identifier to database and later I easily can take iPhone 'B' and connect to the peripheral found by this identifier. Now there is UUID what changes for every iPhone-peripheral connection, but MAC Address is not available. What could you suggest? 回答1: If you do not manufacture the peripheral yourself then you can

Sorting NSTableColumn contents

情到浓时终转凉″ 提交于 2021-02-06 10:55:43
问题 I have a problem with sorting NSTableColumn contents. In my NSTableView there are three columns: File, Size, Path. The contents are stored in NSMutableArray. Each object in this array is a NSDictionary containing three keys: file, size and path - value for each is a NSString. In Interface Builder, in each Table Column's attributes I can choose sorting options: Selector: IB entered "compare:" which I think is ok, because I compare NSStrings. Sort Key - and that's the problem I think - I don't

Unable to retrieve updatedAt or createdAt values from Parse objects

你说的曾经没有我的故事 提交于 2021-02-06 10:14:06
问题 I'm an experienced Android developer trying to get a prototype iOS app running using the Parse service and sdk (https://www.parse.com/). It's great, and i can get all my objects and their values with no trouble, everything works fine. However, i cannot get the updatedAt value automatically created by Parse for each object. It's a must for me, and I dont want to have to save an aditional timestamp as a String when the data is sitting right there. This is the gist of what i was doing. -

Unable to retrieve updatedAt or createdAt values from Parse objects

匆匆过客 提交于 2021-02-06 10:13:12
问题 I'm an experienced Android developer trying to get a prototype iOS app running using the Parse service and sdk (https://www.parse.com/). It's great, and i can get all my objects and their values with no trouble, everything works fine. However, i cannot get the updatedAt value automatically created by Parse for each object. It's a must for me, and I dont want to have to save an aditional timestamp as a String when the data is sitting right there. This is the gist of what i was doing. -

CGDisplayIOServicePort is deprecated in OS X >= 10.9, how to replace?

陌路散爱 提交于 2021-02-06 10:11:51
问题 I did small app to allow quickly change screen resolutions on multiple monitors. I want to show product name as title of the monitor, and it's very simple to find using this code: NSDictionary *deviceInfo = (__bridge NSDictionary *)IODisplayCreateInfoDictionary(CGDisplayIOServicePort(dispID), kIODisplayOnlyPreferredName); NSDictionary *localizedNames = [deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]]; if([localizedNames count] > 0) { _title = [localizedNames

CGDisplayIOServicePort is deprecated in OS X >= 10.9, how to replace?

霸气de小男生 提交于 2021-02-06 10:10:36
问题 I did small app to allow quickly change screen resolutions on multiple monitors. I want to show product name as title of the monitor, and it's very simple to find using this code: NSDictionary *deviceInfo = (__bridge NSDictionary *)IODisplayCreateInfoDictionary(CGDisplayIOServicePort(dispID), kIODisplayOnlyPreferredName); NSDictionary *localizedNames = [deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]]; if([localizedNames count] > 0) { _title = [localizedNames

Objective-C Environment Setup For Ubuntu-Linux

时光怂恿深爱的人放手 提交于 2021-02-06 09:32:46
问题 I don't have the Mac machine for ios development. Now I am in a learning stage and want to start the ios development on Linux. So is it possible to run the Objective-C Code on Linux environment? 回答1: Yes it is possible in Ubuntu to Run the Objective-C code in the following way: In Ubuntu, Install GNU Objective-C Compiler and the Gnu-step Development Libraries with the following command:: sudo apt-get –y install gobjc gnustep gnustep-devel Now type the Program given below and save the file

Custom UIWindows do not rotate correctly in iOS 8

∥☆過路亽.° 提交于 2021-02-06 08:47:11
问题 Get your application into landscape mode and execute the following code: UIWindow *toastWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; toastWindow.hidden = NO; toastWindow.backgroundColor = [[UIColor cyanColor] colorWithAlphaComponent:0.5f]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [toastWindow removeFromSuperview]; }); In iOS 7 you will get a transparent blue overlay on top of the entire screen that

Objective-C++ 11 - Why can't we assign a block to a lambda?

别来无恙 提交于 2021-02-06 02:07:49
问题 So, I just upgraded to Xcode 4.4, and I noticed in the changelog: Apple LLVM compiler supports additional C++11 features, including lambdas Which is awesome! So I got around to coding, and I found a few things out: Lambdas are assignable to Objective-C blocks: void (^block)() = []() -> void { NSLog(@"Inside Lambda called as block!"); }; block(); std::function can hold an Objective-C block: std::function<void(void)> func = ^{ NSLog(@"Block inside std::function"); }; func(); We cant assign an

Objective-C++ 11 - Why can't we assign a block to a lambda?

馋奶兔 提交于 2021-02-06 02:02:05
问题 So, I just upgraded to Xcode 4.4, and I noticed in the changelog: Apple LLVM compiler supports additional C++11 features, including lambdas Which is awesome! So I got around to coding, and I found a few things out: Lambdas are assignable to Objective-C blocks: void (^block)() = []() -> void { NSLog(@"Inside Lambda called as block!"); }; block(); std::function can hold an Objective-C block: std::function<void(void)> func = ^{ NSLog(@"Block inside std::function"); }; func(); We cant assign an