objective-c

iOS <-> PC USB Communication [closed]

百般思念 提交于 2021-02-19 02:27:48
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . Improve this question Is it possible to establish a communication between an OSX (or Windows) Application, and an iOS App, via USB ? I just want my 2 App to be able to communicate with each other, read and write packets... I don't want to use WiFi Is there an "easy way" to do that

kSystemSoundID_Vibrate not working with AVAudioPlayer Play

微笑、不失礼 提交于 2021-02-19 02:04:18
问题 I am working on a half-duplex VOIP call app. In that I am trying to play tones along-with vibration during floor exchanges - floor exchanges are done to change the talker from A to B or vice-versa for a half-duplex call. If I try to play tones using AudioServicesPlayAlertSound, then it plays sound when user gets the call, but not during floor exchanges, due to possible mixing issues with call audio. So I replaced AudioServicesPlayAlertSound with AVAudioPlayer's play function. So, now I am

Mac App Sandbox Group Container problems

百般思念 提交于 2021-02-19 01:58:07
问题 I'm having some trouble with two Sandboxed applications in one Application Group. In my Entitlements file i have the following: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/ PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.app-sandbox</key> <true/> <key>com.apple.security.application-groups</key> <array> <string>TEAM_ID.com.Company.AppName</string> </array> </dict> </plist> Where 'Company' and

How to show ViewController from a non-ViewController helper class?

馋奶兔 提交于 2021-02-19 01:43:13
问题 Usually we call self.presentViewController(...) from some UIViewController object, but how to show a new view controller from a class type (static) function in a helper class which is not a UIViewController. 回答1: You can show your viewController from helper class as root view controller of navigationcontroller UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; UINavigationController *controller = (UINavigationController*)[storyBoard

NSMutableArray containsObject returns true, but it shouldnt

穿精又带淫゛_ 提交于 2021-02-19 01:39:08
问题 I found similar questions, but -containsObject is not working like I expect. My problem is the NSMutableArray -containsObject method returns true when it shouldn't, when trying to generate random UNIQUE colors and add to an array. What is the best way to check if NSMutableArray contains an object with same values. NSMutableArray *color_arr=[NSMutableArray array]; UIColor *t; for(int i=0; i<100; i+=1) { int r = arc4random()%256; int g = arc4random()%256; int b = arc4random()%256; t=[UIColor

Difference between innerhtml and outerhtml in cocoa WebView

时间秒杀一切 提交于 2021-02-18 22:39:30
问题 I am using cocoa webview for rich text editing in my application. Just confused with innerHtml and outerHtml method avaiable in webkit. Can anyone explain what is the difference between [(DOMHTMLElement *)[[[webView mainFrame] DOMDocument] documentElement] outerHTML]; AND [(DOMHTMLElement *)[[[webView mainFrame] DOMDocument] documentElement] outerText]; 回答1: innerHTML is a property of a DOM element that represents the HTML inside the element, i.e. between the opening and closing tags. It has

Localising a UILabel with attributed string from a Storyboard

佐手、 提交于 2021-02-18 20:39:51
问题 I have a UILabel with text set as "attributed" in a storyboard. When I generate the Main.strings file for translating into a different language the text for this label does not appear. I tried to add manually an entry into the Main.strings file by copying the object id. I tried setting the "text" property and the "attributedText" property but when I run the app the translated string is not used. So, how do I localise an UILabel set as "attributed" on a storyboard? 回答1: I ended up solving this

Gpx parser or GPX documentation

瘦欲@ 提交于 2021-02-18 17:14:04
问题 I'm developing an iOS 5 application. I want to develop a GPX parser but I'm wondering if there is one developed before I start to developing it. Do you know if there is an Objective-c GPX parser? 回答1: Have a look at: http://terrabrowser.googlecode.com/svn/trunk/ There you will find GPSFileParser.m and GPSFileParser.h which may help you. 回答2: I have been working on the gpx-api for a little while. It will read gpx files and has a data model that is useable (in my opinion). 回答3: There is no

UIsearchController inside UIViewController using Auto Layout

ぐ巨炮叔叔 提交于 2021-02-18 14:15:34
问题 Has anyone been successful implementing a UIViewController that contais both a UISearchController searchBar and a UItableView while laying everything out using Auto Layout? I'm trying to achieve something similar to what 1Password does on the iPhone: a fixed searchBar on top of a tableView (not part of its tableHeaderView ). When the UISearchController that owns the searchBar gets activated, its searchBar animates to show the scope buttons and thus the tableView moves down a bit. I have got

How to get the distance to a CGPath for hit-testing?

橙三吉。 提交于 2021-02-18 12:47:14
问题 I have an open CGPath/UIBezierPath for which I want to detect if the user touches it, i.e. whether a point is within a certain distance from the path. The path is open (i.e. a line/curve, not a shape). It can contain both straight & curved elements. How do I get the distance to the path to hit-test it? 回答1: It seems neither CGPath/UIBezierPath has a function to do this. EDIT: As per @nielsbot's suggestion, you could write a custom implementation using CGPathApply(…) . Computing the distance