Webview and dynamic content

2010-02-27 Thread Jere Gmail
Hi there, I'm developing an app that relies on a webpage. This page has to load local files (json or xml) that i save on the hard drive. What's the better way to implement it. I've think two options: save the json files in the app resources folder, same way iPhoto stores the files. Or save them in

Re: Webview and dynamic content

2010-02-27 Thread Steven Degutis
Store them in your app's bundle. Related, if you want my 2¢, try as often as you can to avoid using a WebView. If you can replace its functionality with native Cocoa (and Touch) controls then that is the recommended development path. -Steven On Sat, Feb 27, 2010 at 5:39 AM, Jere Gmail wrote: >

Re: UITableView Won't Update; Crashes with EXC_BAD_ACCESS

2010-02-27 Thread Alexander Spohr
Am 27.02.2010 um 02:16 schrieb Jason Berlinsky: > When I remove the NSLog(@"%@",self.data), the application doesn't crash, but > the UITableView doesn't update. When I replace it with fast enumeration over > self.data, I get the crash again (crash log: http://pastebin.com/NDVKLsJC). > > Any id

UITextView as its own delegate - infinite loop on keyboard select

2010-02-27 Thread Roland King
I have a UITextView subclass which, when you touch it to start editing, hangs in an infinite loop before the keyboard comes up. The subclass sets itself as its own delegate in the constructor (because the subclass in this instance wants to capture editing ended events and deal with them internal

NSButton and NSEvent

2010-02-27 Thread Jeremy Matthews
So I have a application that I am getting ready to put some finishing touches on, but there are one or two things I'd like to do differently...er, better. It is a simple tool (Cocoa Desktop app) with a slew of checkboxes (around 40 in a separate window) that act as parameters on a command. While

NSUndoManager for loaded documents

2010-02-27 Thread Sander Stoks
Hello all, Is there something special I need to do so that my NSDocument derivative's "undoManager" method will return an NSUndoManager for documents loaded from disk..? When I create a new document, my undo functionality works, but when I load a document from disk, I get "nil" back. Even whe

Re: #define and if statements

2010-02-27 Thread Jens Alfke
I don't mean to play teacher's-pet, but the moderator did just post the list guidelines a few days ago, including "no plain C questions". There are better places to ask those, including stackoverflow.com. Also, a tip: If you ever have weird errors involving #defines, Xcode's "Preprocess" comman

Re: Webview and dynamic content

2010-02-27 Thread Jens Alfke
On Feb 27, 2010, at 2:39 AM, Jere Gmail wrote: > What's the better way to implement it. I've think two options: save > the json files in the app resources folder, same way iPhoto stores the > files. Or save them in the app support directory. There's no reason to copy the files to the app support

Re: NSButton and NSEvent

2010-02-27 Thread Steven Degutis
First of all, you may want to look into NSMatrix to accomplish this task instead of using individual NSButtons, both for performance reasons and (more importantly) to use the Cocoa API as it is intended (this is why NSMatrix was created, so it handles this relatively well). Secondly, if you use NS

Re: Improving the User Experience for First Use of Downloadable Software

2010-02-27 Thread Greg Guerin
Charles Srstka wrote: Ah, good point. So a better solution would be: NSUserDefaults *def = [NSUserDefaults standardUserDefaults]; if([def boolForKey:@“MyAppHasAlreadyBeenLaunched”]) { [NSApp activateIgnoringOtherApps:YES]; } [def setBool:YES forKey:@“MyAppHasAlreadyBeenLaunched”];

Re: Improving the User Experience for First Use of Downloadable Software

2010-02-27 Thread Dave Carrigan
On Feb 27, 2010, at 10:50 AM, Greg Guerin wrote: > Since you know it's the quarantined attribute that's triggering the problem, > why not just check for that attribute's presence on your app? > > It's a normal extended attribute. You can discover its name using the > 'xattr' command in Termin

Re: Improving the User Experience for First Use of Downloadable Software

2010-02-27 Thread Charles Srstka
On Feb 27, 2010, at 12:50 PM, Greg Guerin wrote: > That won't work properly if the user replaces the current unquarantined > version of your app with a newly downloaded version. Hmm... How about making a “LastOpenedVersion” preference key? If the value is less than your app’s current version, t

Re: #define and if statements

2010-02-27 Thread Kai Brüning
A tip for the next time you have problems with macros: use Xcode’s Preprocess command (in the Build menu) to see your macros resolved. Helps a lot in such cases. Kai On 27.2.2010, at 07:37, Adam Gerson wrote: > Thanks! I can't believe I missed that. Its 1:35am here and its been a long > day.

NSMenuItem Action

2010-02-27 Thread David Blanton
What is the best practice for connecting menu items to their actions? Is it IB, is programatically? If IB what is the process? - db ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to th

Re: NSMenuItem Action

2010-02-27 Thread Steven Degutis
Generally connecting them in IB works just fine. Sometimes this won't be possible, though, and you should use code to do that (like when creating items in code). But, keep in mind that the First Responder is in every NIB file, and works amazingly when you have a menu item that exists in a NIB, and

Re: NSMenuItem Action

2010-02-27 Thread David Blanton
Thanks for the 2 cents ... hope my app will turn it into many dollars! -db On Feb 27, 2010, at 12:50 PM, Steven Degutis wrote: Generally connecting them in IB works just fine. Sometimes this won't be possible, though, and you should use code to do that (like when creating items in code). Bu

How to get my application version from inside my code?

2010-02-27 Thread Bengt Nilsson
Hi! I need to access the bundle version of my application from inside my code to show it in the "About.." box. How can I do this? BN ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to t

Re: How to get my application version from inside my code?

2010-02-27 Thread Steven Degutis
This is already shown in the default About box window, which is sufficient for most apps. But if you really need to have your own custom About box, you can get most of that information from -[NSBundle objectForInfoDictionaryKey:] -Steven On Sat, Feb 27, 2010 at 4:21 PM, Bengt Nilsson wrote: > Hi

Re: How to get my application version from inside my code?

2010-02-27 Thread David Blanton
You don't need to , it is displayed automagically! On Feb 27, 2010, at 2:21 PM, Bengt Nilsson wrote: Hi! I need to access the bundle version of my application from inside my code to show it in the "About.." box. How can I do this? BN ___ Cocoa-d

NSViewAnimation vs Distributed Notification: Bug?

2010-02-27 Thread Iceberg-Dev
[Q] Is there a known bug in NSViewAnimation on Mac OS X 10.4 when it comes to Distributed Notifications? Scenario: - If I animate a window resizing through a NSViewAnimation, some Distributed Notifications are only taken into account after I click in the window resized through a NS

Re: NSViewAnimation vs Distributed Notification: Bug?

2010-02-27 Thread Steven Degutis
Firstly, you do not need to check if tAnimation is nil, since sending a message to nil is valid in ObjC. So I would personally remove that if() and just de-indent all the code that's inside it. Secondly, I *think* what you're running into is the fact that "blocking mode" means the main thread bloc

constructing an NSString with va_list?

2010-02-27 Thread Rick Mann
I'm trying to improve our logging a bit. We have some logging code that calls NSLog(), but that prepends a bunch of fairly useless stuff for our purposes, taking up a significant portion of the line. printf() doesn't, but doesn't understand %...@. I'd like to construct a string by passing in a f

Re: constructing an NSString with va_list?

2010-02-27 Thread Dave Keck
> Is there a way to build an NSString with a va_list? - (id)initWithFormat:(NSString *)format arguments:(va_list)argList; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contac

Re: constructing an NSString with va_list?

2010-02-27 Thread Rick Mann
Wow, thanks. I looked and just didn't see this. Thanks! On Feb 27, 2010, at 16:06:53, Dave Keck wrote: >> Is there a way to build an NSString with a va_list? > > - (id)initWithFormat:(NSString *)format arguments:(va_list)argList; ___ Cocoa-dev mailin

Re: constructing an NSString with va_list?

2010-02-27 Thread Daniel DeCovnick
+ (NSString *)stringWithFormat:(NSString *)format, ... On Feb 27, 2010, at 4:02 PM, Rick Mann wrote: I'm trying to improve our logging a bit. We have some logging code that calls NSLog(), but that prepends a bunch of fairly useless stuff for our purposes, taking up a significant portion of

Re: NSViewAnimation vs Distributed Notification: Bug?

2010-02-27 Thread Iceberg-Dev
On Feb 28, 2010, at 12:35 AM, Steven Degutis wrote: Firstly, you do not need to check if tAnimation is nil, since sending a message to nil is valid in ObjC. So I would personally remove that if() and just de-indent all the code that's inside it. Actually, in the real implementation there's

Re: constructing an NSString with va_list?

2010-02-27 Thread Boyd Collier
Take a look at http://www.cocoabuilder.com/archive/cocoa/205083-nslog-replacement-for-debugger-output.html I've been using Don Arnel's method as modified by Ken Thomases and it works very well. Boyd On Feb 27, 2010, at 4:02 PM, Rick Mann wrote: > I'm trying to improve our logging a bit. We

Re: UITextView as its own delegate - infinite loop on keyboard select

2010-02-27 Thread Kyle Sluder
On Sat, Feb 27, 2010 at 5:39 AM, Roland King wrote: > I have a UITextView subclass which, when you touch it to start editing, hangs > in an infinite loop before the keyboard comes up. The subclass sets itself as > its own delegate in the constructor (because the subclass in this instance > want

Re: NSButton and NSEvent

2010-02-27 Thread Jeremy Matthews
Steven, Thanks - the project needed a revisit...it grew from 2 checkboxes to nearly 40...time to re-examine a few things! Thanks again for the tipso deep into the forest I could not see the trees... -j On Feb 27, 2010, at 1:23 PM, Steven Degutis wrote: > First of all, you may want to look

Re: UITextView as its own delegate - infinite loop on keyboard select

2010-02-27 Thread Roland King
On 28-Feb-2010, at 9:21, Kyle Sluder wrote: Do not make a UITextView its own delegate. More information here: http://lists.apple.com/archives/Cocoa-dev/2009/Jul/msg01406.html --Kyle Sluder Thanks that's what I see too. That thread doesn't explain why of course. I have a trivial tes

Re: UITextView as its own delegate - infinite loop on keyboard select

2010-02-27 Thread Roland King
Oh and one other point after reading that whole thread (on an iPhone that's surprisingly hard!), the application does infinite loop but it doesn't recurse, so I do not believe the suggestion in the middle of that thread that respondsToSelector: checks self and then the delegate (which is it

Re: NSUndoManager for loaded documents

2010-02-27 Thread Jerry Krinock
Private reply since there's not much in here... On 2010 Feb 27, at 05:54, Sander Stoks wrote: > Is there something special I need to do so that my NSDocument derivative's > "undoManager" method will return an NSUndoManager for documents loaded from > disk..? Not that I know of. Should work th

Where in the MVC should my code go?

2010-02-27 Thread Jean-Henri Duteau
I have an interesting MVC question that I would like some advice on. I have a Model object with one attribute. On my View, I display an array of strings that depend upon the value of the model's attribute. I'm unsure where to put the "translation" of the Model attribute into the strings. The

Re: Where in the MVC should my code go?

2010-02-27 Thread Matthew Lindfield Seager
On Sunday, February 28, 2010, Jean-Henri Duteau wrote: > I don't have a good reason to not put it into the view other than pragmatic.   > I can give the controller a bunch of attributes and bind the view's controls > to those attributes, as opposed to programatically creating the strings in > th

Re: Where in the MVC should my code go?

2010-02-27 Thread Jean-Henri Duteau
On 2010-02-28, at 12:23 AM, Matthew Lindfield Seager wrote: > On Sunday, February 28, 2010, Jean-Henri Duteau > wrote: >> I don't have a good reason to not put it into the view other than pragmatic. >> I can give the controller a bunch of attributes and bind the view's >> controls to those a

Re: Is there any Cocoa API (or other way) to determine if an application is running in a VNC or ARD session?

2010-02-27 Thread Matthew Lindfield Seager
On Saturday, February 27, 2010, Jonathan Hendry wrote: > You might try checking for any telltale running processes, or checking the > output of lsof -i for any open sockets that are indicative of a VNC or ARD > connection. That might have to run sudo'd as root. But again you have no way of know