Re: UIApplication terminate?
Hello Steve, On Tue, Mar 16, 2010 at 9:41 AM, Steve Cronin wrote: > Folks; > > I have an iPhone application that is used for a very specific purpose. > > After perusing and modifying data the user is given the option to effectively > [Cancel] or [Save] > > After they have made their decision the app's purpose has been served for > this instance. > What I would like to do is exit gracefully. > > Back in the day you could [NSApp terminate] and all notifications etc were > broadcast and an orderly end was accomplished. > > I don't want to pester the user with another alert or a dead screen for which > the only reasonable action is [Home]. > > I'd like to shut the application down - I believe this is what the user will > desire. > > How do I accomplish this? > exit(0) seems a bit rude for my tastes but…. > > BTW: Is this the sort of thing that can hang up an approval?? (first one to > run that gauntlet in about a week..) > > Thanks for any thoughts! > Steve___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/peter.blazejewicz%40gmail.com > > This email sent to peter.blazejew...@gmail.com > there is official doc (QA): http://developer.apple.com/iphone/library/qa/qa2008/qa1561.html and it is sometimes relinked on Iphone SDK dev forums from time to time, see e.g.: https://devforums.apple.com/message/170720#170720 regards, Peter ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dock position and size
Hi guys, I really appreciate last two comments - but has anyone noticed "read" being used in snippet I've posted? Except of that I think we simply should advice OP to fill radar bug, thanks, and have a nice weekend! kind regards, Peter On Sun, Feb 14, 2010 at 10:02 PM, Kyle Sluder wrote: > On Sun, Feb 14, 2010 at 11:08 AM, Peter Blazejewicz > wrote: >> and change dock positions using preferences, then wrap it through api >> of your choice, > > Changing the Dock position is not your application's business. > > --Kyle Sluder > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dock position and size
Hello Sandro, On Sun, Feb 14, 2010 at 7:10 PM, Sandro Noël wrote: > Greetings. > > Is there a way to determine the dock position on screen (left, right, bottom) > and it's (width - height) ? > Yes, try on your terminal: defaults read com.apple.dock orientation and change dock positions using preferences, then wrap it through api of your choice, hth, regards, Peter Blazejewicz ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone: UIWebView not displaying until scrolled?
Hi Eric, can you post how your web view is animated? If I setup quick test case: @implementation WebViewController @synthesize webView; - (void)viewDidLoad { [super viewDidLoad]; self.webView.delegate = self; NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]; NSURL *url = [[NSURL alloc] initFileURLWithPath:path]; [self.webView loadRequest:[NSURLRequest requestWithURL:url]]; self.webView.alpha = 0.0; [url release]; url = nil; } - (void)viewDidUnload { self.webView = nil; } - (void)dealloc { [webView release]; webView = nil; [super dealloc]; } -(void)webViewDidFinishLoad:(UIWebView *)webView { NSString *loadHandlerStr = @"window.pageLoaded()"; [self.webView stringByEvaluatingJavaScriptFromString:loadHandlerStr]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.5]; self.webView.alpha = 1.0; [UIView commitAnimations]; } @end both UIWebView is animated (and visible) and also content within html web page is drawn (and animated): (JavaScript/CSS) from opacity 0.0: -webkit-transition: opacity 2s linear; to 1.0: elem.style.opacity = 1.0; maybe that is some different issue that somehow became apparent on your web view use, regards, Peter Blazejewicz On Thu, Feb 11, 2010 at 8:40 PM, Eric E. Dolecki wrote: > I am animating a UIWebView after it's loaded - but it doesn't display > anything unless I scroll it a little bit. If I call [webView reload]; my > webViewDidFinishLoad gets called - and that is where I put my [webView > reload] call to fix the display. What is the workaround aside from placing > the UIWebView in the main screen a few pixels? > > -- > http://ericd.net > Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone 3.1] NSInvocation on main thread?
Hi John, NSInvocation can be invoked on main thread as any NSObject subclass simply by performing selector on itself on main thread, However I think you're looking for custom additions similar to that one blogged here (Dave Dribin's blog): http://www.dribin.org/dave/blog/archives/2008/05/22/invoke_on_main_thread/ hth, regards, Peter On Thu, Feb 11, 2010 at 8:09 AM, John Michael Zorko wrote: > > Hello, all ... > > I'm using NSInvocation so I can pass multiple arguments to delegate methods. > However, I also want these delegate methods to get called on the main thread. > Is there a way that I can use NSInvocation to call the method it wraps on the > main thread, like performSelectorOnMainThread? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone 3.1] navigationItem.backBarButtonItem weirdness
Hi John, your selector is missing colon: @selector(back:) for method: -(IBAction)back:(id)sender hth, regards, Peter Blazejewicz On Thu, Feb 11, 2010 at 1:10 AM, John Michael Zorko wrote: > > Hello, all ... > > I've a question about the UINavigationController backBarButtonItem property. > I wanted to merely set my own image for the back button, instead of it using > the title of the controller above in the hierarchy. So, this is what I did > (yes this app is using Three20, but I don't think that's the reason): > > - (id)initWithNavigatorURL:(NSURL *)URL query:(NSDictionary *)query > { > if (self = [super initWithNavigatorURL:URL query:query]) > { > self.navigationItem.backBarButtonItem = [[[UIBarButtonItem > alloc] initWithImage:[UIImage imageNamed:@"backarrow.png"] > style:UIBarButtonItemStylePlain target:self action:@selector(back)] > autorelease]; > } > > return self; > } > > - (void)back:(id)sender > { > } > > Now, this worked -- but I wasn't _expecting_ it to work. I was expecting that > my "back" selector would be called, and I would have to tell the nav > controller to pop. However, my "back" selector isn't called, and the back > button _works_ like it always has. While i'm not in any way against freebees > like this, i'm a bit concerned as to _why_ it works like this. Any > explanation would be appreciated, explanations that actually edify me more so > :-) > > Regards, > > John > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/peter.blazejewicz%40gmail.com > > This email sent to peter.blazejew...@gmail.com > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone: UIWebView scroll position
Hello Eric, Can you clarify? By default when user tap status bar area embedded web view should scroll as any other scroll-enabled views. So that's built-in and should work with your UIWebView. Maybe you want to execute window.scrollTo(...) simply by evaluating JavaScript on your UIWebView instance (stringByEvaluatingJavaScriptFromString)? Like: [NSString stringWithFormat: @"window.scrollTo(0, %d);" value]? kind regards, Peter Blazejewicz On Tue, Feb 9, 2010 at 8:10 PM, Eric E. Dolecki wrote: > I'd like to be able to have a user tap an area which will scroll the > contents of a UIWebView to the top - but I don't see that. Do I have to > stick a UIWebView into a UIScrollView or is there an easier way? > > Eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Threading issues with ivars
Hi Andreas, You're not clearing "text" - you're clearing UILabel reference in your code: self.nameLabel = nil; If you wan't to reset just text then: self.nameLabel.text = @""; (or any way you prefer depending on UI requirements), With your current code you just sending message to nameLabel = which is actually nil in your -(void)updateLabels method, regards, Peter Blazejewicz On Tue, Feb 2, 2010 at 1:49 PM, Andreas Grosam wrote: > Hello, > > I have the following issue: > > > There is a label "nameLabel" which text needs to be set from a certain field > in the dictionary. I don't want to set the label's text property directly in > the main thread's method - instead I use an NSString instance called "name" > to store the text. This is an ivar, see property declaration below. > Before the thread is finished and returns, it schedules the method > -upadateLabels on the main thread which finally sets the label's text > property (shown below). > > > > > - (void) updateLabels > { > self.nameLabel.text = self.name; > } > > > > One *important* observations is here: > Before generating the URL request, I actually need a parameter which is asked > from the user via an interface. > When the user starts to edit the input (a UITextField) the view controller > gets notified through a method, shown below. > The purpose of this method is to clear the previous results. > > ** IFF I do not set the text property to nil, the NSString instance "name" > remains valid. So, it seems, that the string object will be *shared* - but > not copied. Hence the auto release pool does not dealloc the string. The > label's text property is declared as: @property(nonatomic, copy) NSString* > text > This looks strange to me. Any thoughts? > > > - (void)textFieldDidBeginEditing:(UITextField *)textField > { > // User entered editing: clear labels: > self.nameLabel = nil; // if uncommented, the ivar "name" remains valid > } > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/peter.blazejewicz%40gmail.com > > This email sent to peter.blazejew...@gmail.com > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSXMLParser question about duplicate nodes
forKey:kForecastElementTextKey]; [forecast setValue:[attributeDict valueForKey:kForecastElementCodeKey] forKey:kForecastElementCodeKey]; [self.parsedDays addObject:forecast]; [forecast release]; forecast = nil; self.parsedForecastDayCounter++; } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if(qName && ([qName isEqualToString:kForecastElementName])) { // we are done - no reason to parse further after 2 days offered by api if(self.parsedForecastDayCounter >= kMaximumNumberOfDaysToParse) { [parser abortParsing]; return; } } } // called from background thread after parsing is done - (void)forecastParsedForDays:(NSArray *)parsedDays { NSMutableString *outputStr = [[NSMutableString alloc] initWithString:@""]; NSObject *forecast = nil; for (forecast in parsedDays) { [outputStr appendString:[NSString stringWithFormat:@"%@: %...@\n", kForecastElementDayKey, [forecast valueForKey:kForecastElementDayKey]]]; [outputStr appendString:[NSString stringWithFormat:@"%@: %...@\n", kForecastElementDateKey, [forecast valueForKey:kForecastElementDateKey]]]; [outputStr appendString:[NSString stringWithFormat:@"%@: %...@\n", kForecastElementLowKey, [forecast valueForKey:kForecastElementLowKey]]]; [outputStr appendString:[NSString stringWithFormat:@"%@: %...@\n", kForecastElementHightKey, [forecast valueForKey:kForecastElementHightKey]]]; [outputStr appendString:[NSString stringWithFormat:@"%@: %...@\n", kForecastElementTextKey, [forecast valueForKey:kForecastElementTextKey]]]; [outputStr appendString:[NSString stringWithFormat:@"%@: %...@\n", kForecastElementCodeKey, [forecast valueForKey:kForecastElementCodeKey]]]; } self.textView.text = outputStr; [outputStr release]; outputStr = nil; } with regards from reader of your books, Peter Blazejewicz ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Why can't a UITextField be its own delegate?
Hi WT, have you tried - to avoid everything discussed in thread - to use implementation like below one? For what you want it could be more proper avoiding discussed issues and at the same time it hides everything into your subclass (wrapped delegate class details are hidden into module): #import @class CustomTextFieldDelegate; @interface CustomTextField : UITextField { @private CustomTextFieldDelegate * _customDelegate; } @end #import "CustomTextField.h" @interface CustomTextFieldDelegate:NSObject @end @implementation CustomTextFieldDelegate -(BOOL)textField:(UITextField*)text_field shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString*) string { NSLog(@"-textField: shouldChangeCharactersInRange: replacementString:"); return YES; } -(BOOL)textFieldShouldBeginEditing:(UITextField*)text_field { NSLog(@"-textFieldShouldBeginEditing:"); return YES; } - (void)textFieldDidBeginEditing:(UITextField*)text_field { NSLog(@"-textFieldDidBeginEditing:"); } - (BOOL) textFieldShouldEndEditing: (UITextField*) text_field { NSLog(@"-textFieldShouldEndEditing:"); return YES; } - (void) textFieldDidEndEditing: (UITextField*) text_field { NSLog(@"-textFieldDidEndEditing:"); } - (BOOL) textFieldShouldClear: (UITextField*) text_field { NSLog(@"-textFieldShouldClear:"); return YES; } - (BOOL) textFieldShouldReturn: (UITextField*) text_field { NSLog(@"-textFieldShouldReturn:"); [text_field resignFirstResponder]; return YES; } @end @implementation CustomTextField -(void)awakeFromNib { _customDelegate = [[CustomTextFieldDelegate alloc] init]; self.delegate = _customDelegate; self.text = @"Hello World"; [super awakeFromNib]; } -(void)dealloc { [_customDelegate release]; _customDelegate = nil; [super dealloc]; } @end On Sat, Jul 25, 2009 at 9:06 PM, WT wrote: > > Hello all, > > I need to create a subclass of UITextField for a text field that performs > some control over its own editing. The obvious idea is to make the subclass > instance set itself up as its own delegate, but that freezes the app as soon > as the delegate method -textFieldDidBeginEditing returns. > > Looking at Activity Monitor, the CPU usage of the app goes up to nearly 100%. > I've since created the most trivial app with a UITextField subclass that > conforms to the UITextFieldDelegate protocol and which sets itself up as its > own delegate and, sure enough, the app freezes. > > Here's the subclass. Set up a project then add a text field to a view and > make its class be CustomTextField. Compile and run, and watch it freeze when > you attempt to edit the text in the field. > > So... why can't the field be its own delegate? > > Thanks in advance. > Wagner > > > // CustomTextField.h: > > #import > > @interface CustomTextField: UITextField > { > } > > @end > > // CustomTextField.m: > > #import "CustomTextField.h" > > @implementation CustomTextField > > - (void) awakeFromNib > { > super.delegate = self; > super.text = @"Hello world"; > > NSLog(@"awakeFromNib called - delegate set to self"); > } > > // = > // > > - (BOOL) textField: (UITextField*) text_field > shouldChangeCharactersInRange: (NSRange) range > replacementString: (NSString*) string > { > NSLog(@"-textField: shouldChangeCharactersInRange: replacementString:"); > return YES; > } > > // = > // > > - (BOOL) textFieldShouldBeginEditing: (UITextField*) text_field > { > NSLog(@"-textFieldShouldBeginEditing:"); > return YES; > } > > // = > // > > - (void) textFieldDidBeginEditing: (UITextField*) text_field > { > NSLog(@"-textFieldDidBeginEditing:"); > } > > // = > // > > - (BOOL) textFieldShouldEndEditing: (UITextField*) text_field > { > NSLog(@"-textFieldShouldEndEditing:"); > return YES; > } > > // = > // > > - (void) textFieldDidEndEditing: (UITextField*) text_field > { > NSLog(@"-textFieldDidEndEditing:"); > } > > // = > // > > - (BOOL) textFieldShouldClear: (UITextField*) text_field > { > NSLog(@"-textFieldShouldClear:"); > return YES; > } > > // = > // > > - (BOOL) textFieldShouldReturn: (UITextField*) text_field > { > NSLog(@"-textFieldShouldReturn:"); > [self resignFirstResponder]; > return YES; > } > > // = > // > > @end > > ___ > > Cocoa-dev maili
Re: How to use CFReadStrem and abort read stream normally?
Hello Chris, On May 22, 2009, at 5:10 AM, Chris Gardner wrote: Hi, I have already read through CFReadStream archives, and still have trouble with it. After CFReadStreamOpen() has been implement and its status is kCFStreamEventHasBytesAvailable, so I can read data from the source.Of course, there's no problem. As for the FTP server, I can connect it by using CFReadStreamCreateWithFTPURL. Now, I would like to abort/disconnect the read stream when its status is kCFStreamEventHasBytesAvailable. At that time. I will use CFReadStreamClose() and CFRunLoopStop(). As you know, the read stream was availabe in a run loop where data stream can tranfer from FTP server to destination. However, I met a terrible problem which show GDB:Program received signal:"EXC_BAD_ACCESS" as soon as I do above operation, also I see the read stream's status become kCFStreamEventErrorOccurred. So my question is...How can I avoid this error and how can I abort the read stream normally when its status is kCFStreamEventHasBytesAvailable. Your help will be appreciated. Best Regards. Chris Wu have you tried using routine described in docs (unschedule from run loop and close stream)? http://developer.apple.com/documentation/Networking/Conceptual/CFNetwork/CFStreamTasks/CFStreamTasks.html#/ /apple_ref/doc/uid/TP3230-62233 e.g.: CFReadStreamUnscheduleFromRunLoop(myStream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes); CFReadStreamClose(myStream); CFRelease(myStream); kind regards, Peter Blazejewicz ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: High Scores local to iPhone app
hi Eric, On May 5, 2009, at 8:23 PM, Bill Bumgarner wrote: On May 5, 2009, at 11:18 AM, Eric E. Dolecki wrote: I am looking to save and read name/score pairs and started looking at SQLite to do this. I'm checking the Books sample application and there seems to be tons of code in there to basically provide the solution. Is there a better option than SQLite to do this in Obj-C (iPhone)? How many pairs do you plan on storing? If the answer is less than "several hundred", just stick 'em in a property list or plain old text file and write it to the filesystem. b.bum this will work (plist file - also mentioned in other advice as dictionaries/arrays) as storing from ActionScript to SharedObject (without serialization, key/values are OK). Bill advice is fine and easy to implement. For future implementation you could look into SDK 3.0 and CoreData concepts - as I assume you're targeting iPhone SDK as well, regards, Peter Blazejewicz ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: sending emails using URLRequest and php
hi Reza, On Apr 15, 2009, at 7:04 PM, Reza Farhad wrote: That is what I did think initially and I tried that, but did not have any luck. If open the php page in safari I do get a mail sent but not if I try it from my code. Reza Have a look into some ADC documentation, e.g. "Creating RESTful Web Service Clients in Cocoa and Cocoa Touch" http://developer.apple.com/safari/articles/creatingrestfulclients.html - written for RoR but it does not really matter here. What is important is how requests are built on client side. It guides everyone with some server side knowledge through Cocoa/Cocoa Touch client side code very nicely starting from GET requests, regards, Peter Blazejewicz ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa <- > PHP <-> MySQL
hi Steve, this ADC article: http://developer.apple.com/safari/articles/creatingrestfulclients.html should give you all required pointers I think. Even if written as example of REST with Ruby it describes how to do POST/GET (and others) based requests to server side. Examples in article are synchronous ones and you could find it more efficient or better suited for your application to use asynchronous requests with NSURLConnectionDelegate (that part is quite good documented in documentation that ships with Xcode I think), regards, Peter Blazejewicz On Mar 3, 2009, at 10:50 AM, Steve Cronin wrote: Folks; I've inherited some Cocoa code that uses NSMutableNURLRequest and NSURLConnection to pass .php request to a server. The NSMutableURLRequest packs up some data into the the .php which stuffs this data into a MySQL database. This is all working nicely. Now what I've been asked to make happen is to submit a different bit of php which will run a query against this same MySQL database. We want to use Cocoa to submit the php script and retrieve the response, which will be the results of the query. Setting aside the php on the server side, I'm hoping to find a working example of something similar to the Cocoa piece of this new requirement. I'm just looking for how to 'submit', wait for response, capture the response / error in Cocoa. I'll get the server side figured out separately Thanks for any pointers! Steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where to declare/initialise an NSOperationQueue
hi Jacob, Mike Ash has just posted blog entry on subject: http://www.mikeash.com/?page=pyblog/friday-qa-2009-02-13-operations-based-parallelization.html The answer depends on your code objectives, Do you really need NSOperation instances and to queue them? Maybe your task can be executed as single operation just executed in background thread within your controller? (performSelectorInBackgroundThread:withObject:) regards, Peter Blazejewicz On Feb 14, 2009, at 7:49 AM, Jacob Rhoden wrote: Hi Guys, I have been starting to use NSOperationQueue. I have ended up with one put in each controller (ie see below), but now I have one in too many controllers. How does it work? Should I just have one global variable for the operation queue, or do multiple NSOperationQueue's "share" the same resources? I guess I am looking for direction on how best to use it. @interface WebsitesController : NSObject { NSOperationQueue *operationQueue; } Thanks, Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Tab
hi Stefan, have you considered using standard (in terms of Apple HIG) Dock item and/or Apple's menu bar item? To get insight on menu bar items see that 3rd party compilation list: http://menu.jeweledplatypus.org/#/ http://menu.jeweledplatypus.org/meta/ If anything vast majority of developers use custom menu bar items I think (as OS X user I had never use that kind of UI feature you've asked about), regards, Peter On Feb 3, 2009, at 11:35 PM, Stefan Groschupf wrote: Hi All, sorry I'm a newbie to cocoa. I'm looking for a hint, maybe just the right term for a search to find more information. I would love to implement a tab that sits on the screen boarder and if I press it it scrolls out my window. Very much as in OS 9 where you could drag a finder window down to the screen boarder and than this became a tab. En example would be in this screen shot of together http://www.reinventedsoftware.com/together/images/gallery-media/librarywindow.png - the tab on the right side. What would be the right name for such a "tab"/ Is there any kind of widget that does this already in one of the frameworks? Or do I have to build this from scratch? What would I use to build it from scratch? Thanks for any hints. Stefan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: -stringByEvaluatingJavaScriptFromString: return value iphone
hi Marco, I'm not John Resig (http://ejohn.org/) but I would not assume that "return o" will actually evaluate to javascript object/function call, I would rather script: NSString *scriptCode = @"\"Hello\""; or: NSString *scriptCode = @"(function(){return \"hello\";})();"; but I would also fire up Safari (WebKit) script console (ALT+CMD+C) and take few trials with code. Because you're correct of differencies between UIWebView and WebView (@"return \"hello\"" works in WebView) I would look into other place (webkitsk-dev list). Maybe that is because WebKit on OS X is bridged JavaScript<>Objective-C while on Touch OS is not ("return o" does not work in WebKit/Safari interactive console while it works in WebView string code evaluating call). regards, Peter On Jan 31, 2009, at 10:23 PM, Marco Cassinerio wrote: Hi Peter, i tried: - (void)webViewDidFinishLoad:(UIWebView *)webView { NSLog(@"finished: %@",[webView stringByEvaluatingJavaScriptFromString:@"return \"hello\""]); } but it doesn't work, while on os x it does. Thanks Marco ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: -stringByEvaluatingJavaScriptFromString: return value iphone
hi Marco, are you waiting for WebView to report load finished before calling javascript? e.g. see example snippet (loads Google api and calls it): #import @class UIWebView; @interface WebViewController : UIViewController {} @property (nonatomic, readonly) UIWebView *webView; @end #import "WebViewController.h" @implementation WebViewController @dynamic webView; -(UIWebView *)webView { return (UIWebView *)self.view; } - (void)viewDidLoad { [super viewDidLoad]; NSMutableString *htmlCode = [NSMutableString stringWithString:@""]; [htmlCode appendString:@"http://www.google.com/jsapi</a> </tt><tt>\">"]; [htmlCode appendString:@""]; [htmlCode appendString:@"google.load(\"language\", \"1\");"]; [htmlCode appendString:@""]; [self.webView loadHTMLString:htmlCode baseURL:nil]; } - (void)webViewDidFinishLoad:(UIWebView *)webView { NSString *scriptCode = @"google.language.isTranslatable(\"en\")"; NSString *translatable = [webView stringByEvaluatingJavaScriptFromString:scriptCode]; NSLog(@"isTranslatable: %@", (translatable) ? translatable : @"error"); } @end regards, Peter Blazejewicz On Jan 31, 2009, at 5:10 PM, Marco Cassinerio wrote: Hi, i'm trying to execute a javascript function on the iPhone and get the return value. The function is simple: return "hello"; I'm using a UIWebView and the - stringByEvaluatingJavaScriptFromString: method but, while it works on os x, it doesn't on the iPhone. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: release static pointers
hi Christian, On Jan 26, 2009, at 11:25 AM, Christian Giordano wrote: I'm wondering if and how the pointer to the statement will be released. In the code samples I saw there is no trace of the releasing (in this case, sqlite3_finalize(statement)). This is the example: http://icodeblog.com/wp-content/uploads/2008/08/9-todom.png It looks like you started in wrong place. The sample code is certainly based on official Apple's sqlite integration sample: http://developer.apple.com/iphone/library/samplecode/SQLiteBooks/ (go there, registration for online type of ADC account is free), which is far more better place to start I think. To finalize statements there is dedicated class method defined in entity class that gets called when application is to be closed (in blog sample that could be implemented as: @interface ... +(void)finalizeStatements; @implementation +(void)finalizeStatements { if(stmt){ sqlite3_finalize(stmt); stmt = NULL; }; } called as: [Todo finalizeStatements] from one of controllers. regards, Peter ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CFHTTP +authentication
hi John, On Jan 25, 2009, at 8:21 PM, John Michael Zorko wrote: Hello, all ... I guess this is more of a Core Foundation question, but it still seemed more apropos to this list than Carbon-dev. Please let me know if i'm wrong :-) there is better group then Carbon-dev: http://lists.apple.com/mailman/listinfo/macnetworkprog/ 1. How do I get the HTTP return code? I use CFHTTPMessageCreateRequest() to create the GET request, and CFReadStreamCreateForHTTPRequest() to create a CFReadStream for said request. How do I get the response of the request? Details depends if your read stream is blocking or asynchronous. In general getting status code is two steps: #1 create response message reference from read stream #2 get status code from response instance: see section "Checking response": file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Networking/Conceptual/CFNetwork/CFHTTPTasks/chapter_5_section_6.html #//apple_ref/doc/uid/TP3230-61101 regards, Peter ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Safari Download Security Alerts
hi Dave, that's not Safari unique feature. That's system-wide component. In your Xcode documentation window type "file quarantine" or navigate to Guides>Security>Security Overview>Security Services #File Quarantine regards, Peter Blazejewicz On Dec 11, 2008, at 11:53 AM, Dave wrote: Hi All, I have an application that is downloaded from the web by Safari. When the user double-clicks on the .dmg file to open the a Warning Dialog is displayed. My question is, is there anyway of stopping the dialog from appearing? My boss doesn't like it and wants me to look into ways of getting rid of it, but I'm not sure where to start! Thanks in Advance, All the Best Dave Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/peter.blazejewicz%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]