cocoa

Howto “sandbox” my Lion application?

喜夏-厌秋 提交于 2020-01-13 08:32:04
问题 Apple has decreed that all applications submitted to the Mac App Store must be sandboxed, starting in November. Ok, but how can I "sandbox" my app? I found the official Apple's guide Code Signing And Application Sandboxing Guide. This document lists the following steps: 1) "Enable sandboxing for your application." Ok, easy: I have to open Xcode 4, select the project, select the target, go to the Summary tab and check: "Enable Entitlements" "Enable App Sandboxing" ...and every single

Remove Sandboxing

随声附和 提交于 2020-01-13 08:04:08
问题 I have another question dealing with app sandboxing. So I need access to the users' home directory and at the same time the app should be able to shut down the Mac. This requires to not using sandboxing. My problem is that I don't know how to remove sandboxing and being able to submit the app to the Mac App Store. I think that the archives are sandboxed because I had turned it on once.. How to remove sandboxing from the archives properly? Thanks for your help! 回答1: If I understand what you

Matching an approximate string in a Core Data store

放肆的年华 提交于 2020-01-13 07:57:11
问题 I have a small problem with the core data application i'm currently writing. I have two differents models, contexts and peristent stores. One is for my app data, the other one is for a website with relevant infos to me. Most of the time, I match exactly one record from my app to another record from the other source. Sometimes however, I have to fallback to fuzzy string matching to link the two records. I'm trying to match song titles. My local title could be the (made up) "The French Idealist

Suitable key for NSDictionary

拥有回忆 提交于 2020-01-13 07:46:19
问题 Is there a way to determine if a class is suitable as a key and will work as you expect, for example I want to use NSIndexPath as a key in NSDictionary but I don't know for certain if two different NSIndexPath instances with the same integer values will always return the same hash value. 回答1: Apple's NSObject's isEqual document says: If two objects are equal, they must have the same hash value. This last point is particularly important if you define isEqual: in a subclass and intend to put

Suitable key for NSDictionary

人走茶凉 提交于 2020-01-13 07:46:12
问题 Is there a way to determine if a class is suitable as a key and will work as you expect, for example I want to use NSIndexPath as a key in NSDictionary but I don't know for certain if two different NSIndexPath instances with the same integer values will always return the same hash value. 回答1: Apple's NSObject's isEqual document says: If two objects are equal, they must have the same hash value. This last point is particularly important if you define isEqual: in a subclass and intend to put

How to change the device orientation to portrait when the current orientation is faceup or facedown

孤街浪徒 提交于 2020-01-13 07:09:28
问题 Is there a possible way to autorotate the device orientation to portrait when the current orientation of the device is faceup or facedown? 回答1: You can use this trick to make the system refresh your controller orientation anytime you want: [self presentViewController:[UIViewController new] animated:NO completion:NULL]; [self dismissViewControllerAnimated:NO completion:NULL]; This will call supportedInterfaceOrientations on your controller. Just return UIInterfaceOrientationMaskPortrait when

How to change the device orientation to portrait when the current orientation is faceup or facedown

微笑、不失礼 提交于 2020-01-13 07:08:29
问题 Is there a possible way to autorotate the device orientation to portrait when the current orientation of the device is faceup or facedown? 回答1: You can use this trick to make the system refresh your controller orientation anytime you want: [self presentViewController:[UIViewController new] animated:NO completion:NULL]; [self dismissViewControllerAnimated:NO completion:NULL]; This will call supportedInterfaceOrientations on your controller. Just return UIInterfaceOrientationMaskPortrait when

NSXMLDocumentTidyHTML doesn't tidy some XHTML validation errors

流过昼夜 提交于 2020-01-13 06:12:24
问题 I want to grab text from a list of web pages. I've done a bit of experimenting and found that the best way for my needs is via WebKit. Once the source of the page has been grabbed, I want to strip out all the HTML tags, by using the technique in this comment. Here's my code: - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { if(frame == [sender mainFrame]) { NSString *content = [[[[sender mainFrame] dataSource] representation] documentSource]; NSXMLDocument

NSXMLDocumentTidyHTML doesn't tidy some XHTML validation errors

风流意气都作罢 提交于 2020-01-13 06:11:47
问题 I want to grab text from a list of web pages. I've done a bit of experimenting and found that the best way for my needs is via WebKit. Once the source of the page has been grabbed, I want to strip out all the HTML tags, by using the technique in this comment. Here's my code: - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { if(frame == [sender mainFrame]) { NSString *content = [[[[sender mainFrame] dataSource] representation] documentSource]; NSXMLDocument

How do I give my app “assistive access privileges” once “Enable Access for Assistive Devices” has been checked?

寵の児 提交于 2020-01-13 06:04:13
问题 I have an app that uses a (perfectly user-benevolent) system-wide keyboard hook for accessibility purposes. When the app starts up, I check if the "Enable Access for Assistive Devices" setting is checked, as asked by someone else here: Programmatically determine if "enable access for assistive devices" is checked in Cocoa app My problem is that, even after Enabling Access via the checkbox, the app continues to run without those privileges. How do I give the (currently running) app the