Re: Catching actions of fonts "Typography" panel
You are absolutely right, Martin. That was I have thought at the beginning. But it didn't worked. Now I have checked more deeply and looks like I have a bug in my responders chain which prevents me from getting changeAttributes:. Best Regards, Rimas M. On Thu, Aug 25, 2011 at 1:04 AM, Martin Wierschin wrote: The actions you mentioned, font typography options set via Apple's > Typography panel, will send "changeAttributes:" to the first responder. In > your method implementation you'll want to call "convertAttributes:" on the > "sender", eg: > > - (void) changeAttributes:(id)sender > { >NSDictionary* oldAttrs = [self myCurrentAttributes]; >NSDictionary* newAttrs = [sender convertAttributes:oldAttrs]; >// ferret out changes > } > > If you have a NSTextView subclass you can override that method and do the > work there just as easily. > > ~Martin > > ___ 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: NSInvocationOperations mysteriously whacked out of NSOperationQueue
On Aug 25, 2011, at 12:15 AM, Jerry Krinock wrote: > I discovered a bug in my app today caused by the following repeatable > behavior: When one particular NSInvocationOperation in an NSOperationQueue > executes, two others get whacked out of the queue, and thus never execute. > All but three of the operations are instances of my own subclass of > NSOperation. Indexed starting with 1, these operations, numbers 17, 32 and > 40, are NSInvocationOperations. Although all three of the subject > invocations invoke the same target (which happens to be the operation queue) > and the same selector, the three invocations are different objects, and the > three invocation operations are different objects. > Fortunately, NSInvocationOperation is only a convenience, and by simply > replacing these operations with instances of my own NSOperation subclass, the > problem was fixed. > > Can anyone take a stab at explaining this? At a guess, the NSOperationQueue may be dequeuing operations using something like -[NSMutableArray removeObject:] instead of -[NSMutableArray removeObjectIdenticalTo:]. Thus, it is depending on -isEqual:. I further guess that NSInvocationOperation objects with identical targets and selectors compare equal. Definitely sounds like a bug. You could test by a) subclassing NSInvocationOperation to change its equality semantic and seeing if the problem goes away, and b) seeing if you can reproduce with a custom NSOperation subclass which implements equality based on value and not identity. Regards, Ken ___ 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: "iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:
On Aug 24, 2011, at 4:02 AM, David Dengg wrote: > NSDictionary * xmldict = [NSDictionary > dictionaryWithContentsOfFile:libraryXML]; Try loading it using NSPropertyListSerialization, which will return an NSError telling you what went wrong. —Jens smime.p7s Description: S/MIME cryptographic signature ___ 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
Hiding the title bar and adding the default close/maximize/minimize buttons
Hi, I need to hide my window title bar and add the default buttons(close/min/max) to my custom view. I'm using NSWindow's "standardWindowButton:forStyleMask" to get those buttons. I want to emulate the default close button that when you hover over it, it causes the "x" to appear. I tried doing it using a tracking info, and setting it to highlighted when the mouse is over it. (mouseEntered). It seems to work, besides when the window is not active, which in that case, the button look pressed when you set it back to non highlighted (in the mouseExit method) Any way to fix this ? pic attached. [image: screen2.png] Thanks <>___ 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
"iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:
Hello list, one of my customers is reporting that my app does not find the "iTunes Music Library.xml" file. Its there and its filled with data. His iTunes runs fine. He send me the file and to my eyes it looks fine. The way i load it is with: NSDictionary * xmldict = [NSDictionary dictionaryWithContentsOfFile:libraryXML]; This returns nil for this file. The path is correct. For every other file I encountered this worked fine. Is there a way to find out whats causing this error? Or is there a known problem with loading this file that way? Thank you David___ 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
NSInvocationOperations mysteriously whacked out of NSOperationQueue
SHORT STORY I discovered a bug in my app today caused by the following repeatable behavior: When one particular NSInvocationOperation in an NSOperationQueue executes, two others get whacked out of the queue, and thus never execute. LONG STORY Starting with an empty NSOperationQueue, which I have subclassed, I add 40 operations. Each operation is added as a dependency of the next operation, so that they will execute sequentially. All but three of the operations are instances of my own subclass of NSOperation. Indexed starting with 1, these operations, numbers 17, 32 and 40, are NSInvocationOperations. Although all three of the subject invocations invoke the same target (which happens to be the operation queue) and the same selector, the three invocations are different objects, and the three invocation operations are different objects. I am observing the queue's 'operations' using key-value observing; my observer runs whenever an operation is dequeued. During the execution of operation 17, my observer runs, and upon debugging I see that this is because operations 32 and 40, which were there during the previous run, have been somehow whacked out of the queue! Higher-indexed operations have slid up to fill in the resulting gaps. During this time, the method invoked by these operations' invocations has executed only once, for operation 17. My observer runs again a few milliseconds later, as expected, when Operation 17 completes and is dequeued. The call stack under the observer during the double whack indicates that the perpetrator is a secondary thread executing code from the bowels of Grand Central Dispatch… Thread-16- #0 0x00103f90 in -[SSYOperationQueue observeValueForKeyPath:ofObject:change:context:] at SSYOperationQueue.m:252 #1 0x92ce98b4 in NSKeyValueNotifyObserver #2 0x92ccf95d in -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] #3 0x92ccf525 in -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:usingBlock:] #4 0x92cfd44d in __NSOQDelayedFinishOperations #5 0x99de0344 in _dispatch_after_timer_callback #6 0x99de2cc2 in _dispatch_source_invoke #7 0x99ddf6be in _dispatch_queue_invoke #8 0x99ddeeb8 in _dispatch_worker_thread2 #9 0x9629db24 in _pthread_wqthread #10 0x9629f6fe in start_wqthread Fortunately, NSInvocationOperation is only a convenience, and by simply replacing these operations with instances of my own NSOperation subclass, the problem was fixed. Can anyone take a stab at explaining this? On one hand, I don't see how my code could be doing this, because there is no API for removing operations. But on the other hand, there is not likely to be such a heinous bug in Lion. App is built using the 10.6 SDK. I did not test the errant build in 10.6, because spending a half day on this wasn't in my schedule :| Jerry Krinock ___ 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: Odd error logged when coming back from 'Browse All Versions'
On Aug 24, 2011, at 19:24 , Graham Cox wrote: > I can't imagine how a palette would come into version browsing Admittedly I didn't spend a lot of time trying to find a convincing use case, but the example that sprang immediately to mind is if the palette is actually some kind of table of contents for the document. You'd probably want that in the version browser interface too. On Aug 24, 2011, at 20:07 , Graham Cox wrote: > Maybe my understanding is a little off here, but I'd assumed that the > versions "on the right side" were just snapshots (images) of the window > content rather than actual documents. Oh, no. They're not static images. They're documents, in the sense that you can copy pieces of them into the current document normally, and presumably you can edit them (unless your code disables this specifically, which it probably should) though of course you can't save any changes. This is another thing that the WWDC addresses -- in some apps, apparently non-destructive state changes (such as changing which page of the document is visible) are normally undoable and hence make the document dirty. This is another case that needs to be handled carefully in version browsing. ___ 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: Odd error logged when coming back from 'Browse All Versions'
On 2011 Aug 24, at 20:07, Graham Cox wrote: > Maybe my understanding is a little off here, but I'd assumed that the > versions "on the right side" were just snapshots (images) of the window > content rather than actual documents. Oh, I'd assumed that at first too. But in fact they are real instances of your NSDocument subclass, with a full window controller or whatever. If the window has has a scroll view, it scrolls! It it has multiple tabs, click them and they should work! It's kind of scary for a complicated document window. Although Cocoa takes care of not allowing edits for you, if there are other functions which are not appropriate when viewing history, you need to disable them. > Since that's what I'd assumed I haven't been looking for notifications for > these. If they are actual documents, isn't that asking rather a lot of your > app, that it opens potentially hundreds of documents when you enter Versions? No, I think that only two documents are generally open, the "Current" (on the left) and the "History" (on the right). Those other hundreds behind the "History" are probably faked by a title bar image as you had originally assumed. > I thought it only replaced the data content of the document when you actually > chose one to restore. Have not tested that, but I'd suspect replaces the whole document object. ___ 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: Odd error logged when coming back from 'Browse All Versions'
On 25/08/2011, at 12:53 PM, Jerry Krinock wrote: > When user clicks "Browse All Versions", the current document window jumps to > the left side of the Star Wars screen. That document has "entered the > version browser". However, another document, the previous version, opens in > a window in the right side of the Star Wars screen. That's what I mean by > "the right side". In my testing, this document on the right side does not > get the NSWindowWillEnterVersionBrowserNotification. I supposed that the > justification is that it never *entered* the version browser; it began its > life there. But I need to do some setup for the versions browser just the > same. So I wrote a bunch of kludgey code to work around that. Maybe my understanding is a little off here, but I'd assumed that the versions "on the right side" were just snapshots (images) of the window content rather than actual documents. Since that's what I'd assumed I haven't been looking for notifications for these. If they are actual documents, isn't that asking rather a lot of your app, that it opens potentially hundreds of documents when you enter Versions? I thought it only replaced the data content of the document when you actually chose one to restore. H…. seems I have a way to go to wrap my head around all this stuff. Anyway, what's going in within Versions isn't all that important right now - in fact hiding all the palettes is fine. It's not showing them again that I have a gripe with, but I do have my workaround working now. >> Basic Revert is broken in some way and hangs, but that might be my fault. > > How much you want to bet that -[NSDocument > performActivityWithSynchronousWaiting:usingBlock:] is not involved? I wouldn't want to take that bet :) --Graham ___ 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: Odd error logged when coming back from 'Browse All Versions'
On 2011 Aug 24, at 18:45, Graham Cox wrote: > Can you explain what you mean by a document opening on the right hand side? I > can't seem to get that to happen. When user clicks "Browse All Versions", the current document window jumps to the left side of the Star Wars screen. That document has "entered the version browser". However, another document, the previous version, opens in a window in the right side of the Star Wars screen. That's what I mean by "the right side". In my testing, this document on the right side does not get the NSWindowWillEnterVersionBrowserNotification. I supposed that the justification is that it never *entered* the version browser; it began its life there. But I need to do some setup for the versions browser just the same. So I wrote a bunch of kludgey code to work around that. > Basic Revert is broken in some way and hangs, but that might be my fault. How much you want to bet that -[NSDocument performActivityWithSynchronousWaiting:usingBlock:] is not involved? > The 'Browse All Versions' seems to work, and I get the notifications reliably. See if you get them in on the "right side". ___ 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: Odd error logged when coming back from 'Browse All Versions'
On 25/08/2011, at 12:03 PM, Quincey Morris wrote: > As to why this isn't automatic, the answer is hinted at, earlier in the > video. The versions browser doesn't know what parts of your user interface > are necessary for interacting with the document window during version > browsing. It could just as easily turn out that you *do* want a palette shown > during browsing. It all depends on the function of the palette. Currently, it > appears, palette windows are hidden by default on entry to the mode, and not > restored on exit, and there's a hint that this behavior is not set in stone. While I can't imagine how a palette would come into version browsing, I will accept that there's a use case beyond my imagination. Fair enough. What I do find hard to comprehend is how the use case of leaving them all hidden all by default is reasonable. The system takes care of hiding all and restoring all on a suspend/resume, on the basis that the app's state hasn't really changed. Surely that's true for version browsing as well? Sure, the document itself may have changed its internal state, but the app state has not - you've reverted to an earlier version of the document or not, but what you're doing with that document is the same. > Adding two 1-line delegate methods in order to make your intentions explicit > doesn't seem unnecessarily onerous. I *think* what you're actually > discovering is that *after* taking a run at implementing various new 10.7 > features, it's worthwhile to watch the videos again. At that point, you're > going to be primed to absorb how to deal with the wiggly bits around the > edges, which are to a great extent what the WWDC sessions are about. It's not that onerous, just surprising. It means that to adopt the new document features, which to be a case of returning a simple YES/NO switch, your app suddenly behaves in a way that seems broken without additional work. The additional work would be eased if the app delegate received some sort of global notification about entering and leaving the version browsing mode, but it doesn't - only the document window does, meaning you have to punt the notification up to a global app level within your app to act upon it (in my case, not untypical, my inspectors are global objects which are sensitive to any document context). So it's not just a 2-line override, it amounts to quite a bit more than that. Another alternative would be that the palettes themselves received a notification about entering/leaving this mode. It just feels that it hasn't been fully thought through. I will take a look at the sessions. --Graham ___ 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: Odd error logged when coming back from 'Browse All Versions'
On Aug 24, 2011, at 18:45 , Graham Cox wrote: > On 25/08/2011, at 11:28 AM, Jerry Krinock wrote: > >> We have NSWindowWillEnterVersionBrowserNotification and >> NSWindowDidExitVersionBrowserNotification, however I found the former is not >> received if a document *opens* on the right side of the version browser, >> i.e. if the user "browses" to it. Maybe that doesn't matter in your case. > > > Jerry, I'm now using these notifications on my main document to send further > notifications to my app delegate which can save and restore my inspector > states. I'm convinced this should be done by Cocoa, but as a workaround I can > live with it. This issue is mentioned in the "Versions" WWDC session video (around the 45:30 mark). Briefly, the suggested method is to use window delegate methods (typically implemented in the window controller) 'windowWill/DidEnter/ExitVersionBrowser' to hide/show palette windows as necessary. As to why this isn't automatic, the answer is hinted at, earlier in the video. The versions browser doesn't know what parts of your user interface are necessary for interacting with the document window during version browsing. It could just as easily turn out that you *do* want a palette shown during browsing. It all depends on the function of the palette. Currently, it appears, palette windows are hidden by default on entry to the mode, and not restored on exit, and there's a hint that this behavior is not set in stone. Adding two 1-line delegate methods in order to make your intentions explicit doesn't seem unnecessarily onerous. I *think* what you're actually discovering is that *after* taking a run at implementing various new 10.7 features, it's worthwhile to watch the videos again. At that point, you're going to be primed to absorb how to deal with the wiggly bits around the edges, which are to a great extent what the WWDC sessions are about. ___ 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: Odd error logged when coming back from 'Browse All Versions'
On 25/08/2011, at 11:28 AM, Jerry Krinock wrote: > We have NSWindowWillEnterVersionBrowserNotification and > NSWindowDidExitVersionBrowserNotification, however I found the former is not > received if a document *opens* on the right side of the version browser, i.e. > if the user "browses" to it. Maybe that doesn't matter in your case. Jerry, I'm now using these notifications on my main document to send further notifications to my app delegate which can save and restore my inspector states. I'm convinced this should be done by Cocoa, but as a workaround I can live with it. Can you explain what you mean by a document opening on the right hand side? I can't seem to get that to happen. Basic Revert is broken in some way and hangs, but that might be my fault. The 'Browse All Versions' seems to work, and I get the notifications reliably. --Graham ___ 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: Odd error logged when coming back from 'Browse All Versions'
On 2011 Aug 24, at 17:17, Graham Cox wrote: > Can I get a notification that my app returned from browsing Versions (and is > entering Versions)? Terminology: "browsing versions" is called "viewing mode", as in "you can view but you can't edit". We have NSWindowWillEnterVersionBrowserNotification and NSWindowDidExitVersionBrowserNotification, however I found the former is not received if a document *opens* on the right side of the version browser, i.e. if the user "browses" to it. Maybe that doesn't matter in your case. We also have -[NSDocument isInViewingMode], although I found that it sometimes tells me that we're not in viewing mode when in fact we are. I could post a bunch of code I use to work around these issues, but I'd rather not pollute the list unless someone thinks they need it. ___ 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: Odd error logged when coming back from 'Browse All Versions'
On 25/08/2011, at 10:17 AM, Graham Cox wrote: > Can I get a notification that my app returned from browsing Versions (and is > entering Versions)? I found the added window delegate methods that notify windows entering and leaving Versions. They are not called for my palettes. I like Versions. It will be even better when it's finished. --Graham ___ 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: Confused with block completionHandler
All these answers are great. Thanks On Aug 24, 2011, at 9:01 PM, Graham Cox wrote: > > On 25/08/2011, at 10:46 AM, Brad Stone wrote: > >> I need to call this method manually but I'm confused how to format the >> completionHandler. I don't understand what I'm reading. Can anyone give me >> an example of how to define the completionHandler or point me to some >> documentation? >> >> [self saveToURL:[self fileURL] ofType:@"myDocType" >> forSaveOperation:NSAutosaveInPlaceOperation completionHandler:^(I'm >> confused!!!)]; >> >> This is the method definition >> - (void)saveToURL:(NSURL *)url ofType:(NSString *)typeName >> forSaveOperation:(NSSaveOperationType)saveOperation completionHandler:(void >> (^)(NSError *errorOrNil))completionHandler >> >> I've used blocks before like below but I don't understand the syntax above >> and I couldn't find an example on the internet or the documentation. Any >> help would be appreciated. >> [openPanel beginSheetModalForWindow:[NSApp keyWindow] >> completionHandler:^(NSInteger theResult) { >> if (theResult) { >> // some code here >> } > > > Separate the block definition from the calling method to make it clearer: > > > void (^completionHandler)(NSError*) = ^(NSError* error) > { > // here, write the code that makes up the body of the completion handler > > > } > > [self saveToURL:[self fileURL] ofType:@"myDoc" forSaveOperation:saveOp > completionHandler:completionHandler]; > > > Here we just named the block 'completionHandler', but it could be anything, > such as 'fred' - it's just a variable identifier. > > > > --Graham > > ___ 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: Confused with block completionHandler
On 25/08/2011, at 10:46 AM, Brad Stone wrote: > I need to call this method manually but I'm confused how to format the > completionHandler. I don't understand what I'm reading. Can anyone give me > an example of how to define the completionHandler or point me to some > documentation? > > [self saveToURL:[self fileURL] ofType:@"myDocType" > forSaveOperation:NSAutosaveInPlaceOperation completionHandler:^(I'm > confused!!!)]; > > This is the method definition > - (void)saveToURL:(NSURL *)url ofType:(NSString *)typeName > forSaveOperation:(NSSaveOperationType)saveOperation completionHandler:(void > (^)(NSError *errorOrNil))completionHandler > > I've used blocks before like below but I don't understand the syntax above > and I couldn't find an example on the internet or the documentation. Any > help would be appreciated. > [openPanel beginSheetModalForWindow:[NSApp keyWindow] > completionHandler:^(NSInteger theResult) { > if (theResult) { > // some code here > } Separate the block definition from the calling method to make it clearer: void (^completionHandler)(NSError*) = ^(NSError* error) { // here, write the code that makes up the body of the completion handler } [self saveToURL:[self fileURL] ofType:@"myDoc" forSaveOperation:saveOp completionHandler:completionHandler]; Here we just named the block 'completionHandler', but it could be anything, such as 'fred' - it's just a variable identifier. --Graham ___ 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: Confused with block completionHandler
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/24/11 5:46 PM, Brad Stone wrote: > This is the method definition - (void)saveToURL:(NSURL *)url > ofType:(NSString *)typeName > forSaveOperation:(NSSaveOperationType)saveOperation > completionHandler:(void (^)(NSError *errorOrNil))completionHandler This indicates it is expecting a block with no return value and accepting one argument, a pointer to an NSError. So you would pass in something like: ^(NSError *error) { // Do something with error if present } as the completionHandler. > I've used blocks before like below but I don't understand the > syntax above and I couldn't find an example on the internet or the > documentation. Any help would be appreciated. [openPanel > beginSheetModalForWindow:[NSApp keyWindow] > completionHandler:^(NSInteger theResult) { if (theResult) { // some > code here } This is very similar to the above. I recommend http://developer.apple.com/library/ios/#featuredarticles/Short_Practical_Guide_Blocks/_index.html. - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFOVZ43aOlrz5+0JdURAl7eAJ4t2zkF12CQxjgTLiYPmMyDesJGEgCfT7zS 0uiVWwR5cNFVYwNvjyLVlAg= =Kj0v -END PGP SIGNATURE- ___ 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: Confused with block completionHandler
It looks like you've basically got it with your openPanel example. The only difference in the document example is that the parameter to the block is an NSError*. So, your call would look something like this: [self saveToURL:[self fileURL] ofType:@"myDocType" forSaveOperation:NSAutosaveInPlaceOperation completionHandler:^(NSError* error) { if (error) { // do some error handling } else { // do other work } }]; Luke On Aug 24, 2011, at 5:46 PM, Brad Stone wrote: > I need to call this method manually but I'm confused how to format the > completionHandler. I don't understand what I'm reading. Can anyone give me > an example of how to define the completionHandler or point me to some > documentation? > > [self saveToURL:[self fileURL] ofType:@"myDocType" > forSaveOperation:NSAutosaveInPlaceOperation completionHandler:^(I'm > confused!!!)]; > > This is the method definition > - (void)saveToURL:(NSURL *)url ofType:(NSString *)typeName > forSaveOperation:(NSSaveOperationType)saveOperation completionHandler:(void > (^)(NSError *errorOrNil))completionHandler > > I've used blocks before like below but I don't understand the syntax above > and I couldn't find an example on the internet or the documentation. Any > help would be appreciated. > [openPanel beginSheetModalForWindow:[NSApp keyWindow] > completionHandler:^(NSInteger theResult) { > if (theResult) { > // some code here > } > > Thanks___ > > 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/luketheh%40apple.com > > This email sent to luket...@apple.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
Confused with block completionHandler
I need to call this method manually but I'm confused how to format the completionHandler. I don't understand what I'm reading. Can anyone give me an example of how to define the completionHandler or point me to some documentation? [self saveToURL:[self fileURL] ofType:@"myDocType" forSaveOperation:NSAutosaveInPlaceOperation completionHandler:^(I'm confused!!!)]; This is the method definition - (void)saveToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation completionHandler:(void (^)(NSError *errorOrNil))completionHandler I've used blocks before like below but I don't understand the syntax above and I couldn't find an example on the internet or the documentation. Any help would be appreciated. [openPanel beginSheetModalForWindow:[NSApp keyWindow] completionHandler:^(NSInteger theResult) { if (theResult) { // some code here } Thanks___ 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: Odd error logged when coming back from 'Browse All Versions'
On 25/08/2011, at 1:44 AM, Kevin Perry wrote: > Right now, Versions doesn't bring back the inspectors automatically, but it > may do so in the future. For now, bringing them back manually is the right > thing. That's useless. Can I get a notification that my app returned from browsing Versions (and is entering Versions)? Users won't understand that they have to reshow the windows manually - they'll simply complain our app is buggy and the windows 'disappear'. I'm OK with working around the issue, but I'm not prepared to accept it as correct behaviour. > As for the logging, it's a known OS bug, but is basically harmless. OK, I'll ignore it. My thinking was that this was throwing an exception that interrupted the window reshowing process. I can't believe the palettes are not restored automatically, as for when an app is suspended and resumed. That's just wrong. --Graham ___ 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: Representation of strings with special chars
On Aug 24, 2011, at 3:45 PM, Greg Parker wrote: > That's because you are still using [s length] to get the length of [s > UTF8String]. Don't do that. If you add more umlauts then it will stop working > again. Ow. I didn’t see that problem in the code. Definitely a showstopper. Alexander, what you probably want to do is call [s dataUsingEncoding:NSUTF8StringEncoding], then pass data.bytes and data.length into the MySQL API. (Or you could instead call strlen on the result of -UTF8String, but it’s more overhead.) —Jens smime.p7s Description: S/MIME cryptographic signature ___ 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: Representation of strings with special chars
On Aug 24, 2011, at 2:14 PM, Alexander Reichstadt wrote: > It seems a work-around is to append a space to the select-statement, mysql > does not care about that and it brings the umlaut-problem to cease in > select-statements. Does this only cover some other issue that is going to > return, or is this valid? That's because you are still using [s length] to get the length of [s UTF8String]. Don't do that. If you add more umlauts then it will stop working again. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ 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: Representation of strings with special chars
On Aug 24, 2011, at 2:14 PM, Alexander Reichstadt wrote: > It seems a work-around is to append a space to the select-statement, mysql > does not care about that and it brings the umlaut-problem to cease in > select-statements. Does this only cover some other issue that is going to > return, or is this valid? I found a thread talking about the length with > umlauts being not clear to answer in some cases which lead me to try this. It > doesn't seem like a feature, but I wouldn't know what to log a bug against. I think you’re going to need to get some Unicode references and look at the exact UTF-8 byte sequences that are being generated as commands to MySQL. (You should also verify that the connection to MySQL is actually expecting UTF-8 and not some other encoding.) If you can figure out what’s wrong with the data being sent, you’ll have an idea of how to fix it. I think it’s very unlikely there is an actual Foundation bug here, as this is really a pretty ordinary usage of NSString. —Jens smime.p7s Description: S/MIME cryptographic signature ___ 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
codesign
hi, i'm not using xcode but want to codesign my Mac App manually. which commands do I need to enable my Mac App to connect with the APNS. regards, jaap ___ 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: Representation of strings with special chars
It seems a work-around is to append a space to the select-statement, mysql does not care about that and it brings the umlaut-problem to cease in select-statements. Does this only cover some other issue that is going to return, or is this valid? I found a thread talking about the length with umlauts being not clear to answer in some cases which lead me to try this. It doesn't seem like a feature, but I wouldn't know what to log a bug against. In this context I also observed some bug in Xcode. Using opt-arrow in a text to move through the text in Cocoa apps allows to skip an entire word, not only a single character. But skipping over somewordAÜsomeotherwordB will not bring the cursor from before the s to after the d, but instead hop from s to after A to after Ü to after B. Am 24.08.2011 um 22:24 schrieb Alexander Reichstadt: > Actually it's a couple of wrapper-classes to MYSQL c-calls by Karl Kraft. > > In the sqlfetch-class, eventually it arrives at > > mysql_stmt_prepare(myStatement, [s UTF8String],[s length]) > > where s is the NSString instance containing the SELECT-statement, such as > SELECT field="someÜberthing". > > From there it goes on to > > int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, >unsigned long length); > > > and at this point it fails. > > > > > > > > Am 24.08.2011 um 20:15 schrieb Sean McBride: > >> On Wed, 24 Aug 2011 20:07:40 +0200, Alexander Reichstadt said: >> >>> Reason to ask and problem to solve is, that the values with Umlauts are >>> to be passed on to an SQL backend, and in some cases the umlauts are not >>> forwarded correctly. Escaped they return no answer or, even worse, cause >>> an SQL error and the sql connection to break. Also escaping the umlauts >>> int he sql connection does not work. >> >> I'm assuming your SQL backend does not understand NSString. How do you >> convert from NSString, and to what do you convert? Which text encoding is >> your backend expecting? >> >> -- >> >> Sean McBride, B. Eng s...@rogue-research.com >> Rogue Researchwww.rogue-research.com >> Mac Software Developer Montréal, Québec, Canada >> >> > ___ 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: Catching actions of fonts "Typography" panel
> Delegate methods could be used if there is an editable textview. But what if > not? For other things we have "changeFont:, changeColor:, > changeAttributes:". Unfortunately, neither of them are called by action I > have mentioned. The actions you mentioned, font typography options set via Apple's Typography panel, will send "changeAttributes:" to the first responder. In your method implementation you'll want to call "convertAttributes:" on the "sender", eg: - (void) changeAttributes:(id)sender { NSDictionary* oldAttrs = [self myCurrentAttributes]; NSDictionary* newAttrs = [sender convertAttributes:oldAttrs]; // ferret out changes } If you have a NSTextView subclass you can override that method and do the work there just as easily. ~Martin ___ 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: Representation of strings with special chars
On Aug 24, 2011, at 1:24 PM, Alexander Reichstadt wrote: > Actually it's a couple of wrapper-classes to MYSQL c-calls by Karl Kraft. > > In the sqlfetch-class, eventually it arrives at > > mysql_stmt_prepare(myStatement, [s UTF8String],[s length]) > > where s is the NSString instance containing the SELECT-statement, such as > SELECT field="someÜberthing". > > From there it goes on to > > int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, > unsigned long length); > > and at this point it fails. First, [s length] is the wrong value to pass as the length of [s UTF8String]. Try this instead: const char *cstr = [s UTF8String]; mysql_stmt_prepare(myStatement, cstr, strlen(cstr)); Second, this code is sending UTF-8 encoded character data to MySQL. Make sure that your MySQL environment is configured to accept UTF-8 data. http://rentzsch.tumblr.com/post/9133498042/howto-use-utf-8-throughout-your-web-stack If your MySQL system instead expects some other encoding like ISO Latin-1, you can tell NSString to output that instead. [myString cStringUsingEncoding:NSISOLatin1StringEncoding]; -- Greg Parker gpar...@apple.com Runtime Wrangler ___ 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: Representation of strings with special chars
Actually it's a couple of wrapper-classes to MYSQL c-calls by Karl Kraft. In the sqlfetch-class, eventually it arrives at mysql_stmt_prepare(myStatement, [s UTF8String],[s length]) where s is the NSString instance containing the SELECT-statement, such as SELECT field="someÜberthing". From there it goes on to int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, unsigned long length); and at this point it fails. Am 24.08.2011 um 20:15 schrieb Sean McBride: > On Wed, 24 Aug 2011 20:07:40 +0200, Alexander Reichstadt said: > >> Reason to ask and problem to solve is, that the values with Umlauts are >> to be passed on to an SQL backend, and in some cases the umlauts are not >> forwarded correctly. Escaped they return no answer or, even worse, cause >> an SQL error and the sql connection to break. Also escaping the umlauts >> int he sql connection does not work. > > I'm assuming your SQL backend does not understand NSString. How do you > convert from NSString, and to what do you convert? Which text encoding is > your backend expecting? > > -- > > Sean McBride, B. Eng s...@rogue-research.com > Rogue Researchwww.rogue-research.com > Mac Software Developer Montréal, Québec, Canada > > ___ 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: Animated Split View
On 01 Jun 2011, at 12:07, Antonio Nunes wrote: > I want a generic animated split view. So I had a rummage online, and couldn't > find anyone who had prepared the wheel for me. Consequently I set out to > create my own. I soon found that overriding setPosition:ofDividerAtIndex: > and make it work correctly for split views with more than two views was not > as simple as I expected it to be. Then I had a Bright Idea™ in realising that > Apple have already done all the heavy lifting for me, and that I could use > that to my advantage: > > I created a category on NSSplitView which adds exactly two methods: > > @interface NSSplitView (NSSplitView_Animation) > > - (CGFloat)catPositionOfDividerAtIndex:(NSInteger)index; > - (void)catAnimateDividerAtIndex:(NSInteger)index > toPosition:(CGFloat)newPosition; > > @end > > @implementation NSSplitView (NSSplitView_Animation) > > - (CGFloat)catPositionOfDividerAtIndex:(NSInteger)index > { > NSRect frame = [[self.subviews objectAtIndex:index] frame]; > return self.isVertical ? NSMaxX(frame) : NSMaxY(frame); > } > > - (void)catAnimateDividerAtIndex:(NSInteger)index > toPosition:(CGFloat)newPosition > { > CGFloat currentPosition = [self catPositionOfDividerAtIndex:index]; > NSUInteger numberOfSubviews = self.subviews.count; > NSRect newRect[numberOfSubviews]; > > [self setPosition:newPosition ofDividerAtIndex:index]; > > for (NSUInteger i = 0; i < numberOfSubviews; i++) { > newRect[i] = [[self.subviews objectAtIndex:i] frame]; > } > > [self setPosition:currentPosition ofDividerAtIndex:index]; > > [NSAnimationContext beginGrouping]; { > [[NSAnimationContext currentContext] setDuration:0.2]; > for (NSUInteger i = 0; i < numberOfSubviews; i++) { > [[[self.subviews objectAtIndex:i] animator] > setFrame:newRect[i]]; > } > } [NSAnimationContext endGrouping]; > } > > @end > > I'm posting this for two reasons: > 1. I want to ask if anyone thinks the technique used above has caveats or if > anyone thinks the technique is inefficient and can think of a more efficient > or better way to implement animation for NSSplitView. > 2. It appears to work quite nicely for splitviews in either orientation, with > any number of subviews, including sub-splitviews. If there is no solid reason > to avoid this technique, it may be useful to others who are trying to do > similar things with NSSplitView. > > Any comments appreciated. > Hi, thanks for posting this code. I've used it in a new app I'm making. However, I wanted to let you know that I've found a problem when the splitview happens to have a delegate that implements: splitView:constrainMaxCoordinate:ofSubviewAt: splitView:constrainMinCoordinate:ofSubviewAt: splitView:canCollapseSubview: When the divider is first set to its desired position, this could cause one of the subviews to collapse, because of the delegate doing its work. This causes the size of the collapsed view to be calculated in a wrong way because a collapsed subview in a splitview is retained with its original frame size prior to the collapse. So where one would expect eg. a zero width, the actual width of the frame is different. Of course, when eventually the subviews are animated to their desired position and size, the result is not what was expected. I solved this problem by temporarily replacing the splitview delegate with 'self' as a delegate (only implementing 'splitView:shouldHideDividerAtIndex:') prior to the animation, and restoring the original delegate post animation. Because of some other considerations, I also chose to implement your code in a subclass rather than a category. -- Luc Van Bogaert http://users.skynet.be/luc.van.bogaert ___ 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: Representation of strings with special chars
On Aug 24, 2011, at 11:14 AM, David Duncan wrote: > On Aug 24, 2011, at 11:07 AM, Alexander Reichstadt wrote: > >> we have a phenomenon, that is not quite clear. This is with 10.6.7 Xcode 4.0. >> >> NSArray *test = [NSArray arrayWithObject:@"ÜÄÖüäö"]; >> NSLog(@"%@",test); >> NSLog(@"%@",[test objectAtIndex:0]); >> >> This prints out the following: >> >> 2011-08-24 20:03:19.129 PetWorkX[15717:903] ( >> "\U00dc\U00c4\U00d6\U00fc\U00e4\U00f6" >> ) >> 2011-08-24 20:03:19.129 PetWorkX[15717:903] ÜÄÖüäö >> >> Reason to ask and problem to solve is, that the values with Umlauts are to >> be passed on to an SQL backend, and in some cases the umlauts are not >> forwarded correctly. Escaped they return no answer or, even worse, cause an >> SQL error and the sql connection to break. Also escaping the umlauts int he >> sql connection does not work. >> >> So far we weren't able to fully figure out under which conditions the >> umlauts are passed on correctly and under what conditions they aren't. > > > In this case since you are using a compiler literal, you are at the mercy of > what the compiler generates. It would seem that you are getting composed > characters in this case (your second NSLog should use %C not %@ btw). The > best I can figure is that your SQL backend is expecting decomposed characters > (which would represent this string as UA > etc). I would try -decomposedStringWithCanonicalMapping to obtain a new > string that has been decomposed and see if that works better. > -- The second NSLog is fine; [test objectAtIndex:0] is the NSString in the NSArray, not the first char in the NSString.___ 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: Representation of strings with special chars
On Wed, 24 Aug 2011 20:07:40 +0200, Alexander Reichstadt said: >Reason to ask and problem to solve is, that the values with Umlauts are >to be passed on to an SQL backend, and in some cases the umlauts are not >forwarded correctly. Escaped they return no answer or, even worse, cause >an SQL error and the sql connection to break. Also escaping the umlauts >int he sql connection does not work. I'm assuming your SQL backend does not understand NSString. How do you convert from NSString, and to what do you convert? Which text encoding is your backend expecting? -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: Representation of strings with special chars
On Aug 24, 2011, at 11:07 AM, Alexander Reichstadt wrote: > we have a phenomenon, that is not quite clear. This is with 10.6.7 Xcode 4.0. > >NSArray *test = [NSArray arrayWithObject:@"ÜÄÖüäö"]; >NSLog(@"%@",test); >NSLog(@"%@",[test objectAtIndex:0]); > > This prints out the following: > > 2011-08-24 20:03:19.129 PetWorkX[15717:903] ( >"\U00dc\U00c4\U00d6\U00fc\U00e4\U00f6" > ) > 2011-08-24 20:03:19.129 PetWorkX[15717:903] ÜÄÖüäö > > Reason to ask and problem to solve is, that the values with Umlauts are to be > passed on to an SQL backend, and in some cases the umlauts are not forwarded > correctly. Escaped they return no answer or, even worse, cause an SQL error > and the sql connection to break. Also escaping the umlauts int he sql > connection does not work. > > So far we weren't able to fully figure out under which conditions the umlauts > are passed on correctly and under what conditions they aren't. In this case since you are using a compiler literal, you are at the mercy of what the compiler generates. It would seem that you are getting composed characters in this case (your second NSLog should use %C not %@ btw). The best I can figure is that your SQL backend is expecting decomposed characters (which would represent this string as UA etc). I would try -decomposedStringWithCanonicalMapping to obtain a new string that has been decomposed and see if that works better. -- David Duncan ___ 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
Representation of strings with special chars
Hi, we have a phenomenon, that is not quite clear. This is with 10.6.7 Xcode 4.0. NSArray *test = [NSArray arrayWithObject:@"ÜÄÖüäö"]; NSLog(@"%@",test); NSLog(@"%@",[test objectAtIndex:0]); This prints out the following: 2011-08-24 20:03:19.129 PetWorkX[15717:903] ( "\U00dc\U00c4\U00d6\U00fc\U00e4\U00f6" ) 2011-08-24 20:03:19.129 PetWorkX[15717:903] ÜÄÖüäö Reason to ask and problem to solve is, that the values with Umlauts are to be passed on to an SQL backend, and in some cases the umlauts are not forwarded correctly. Escaped they return no answer or, even worse, cause an SQL error and the sql connection to break. Also escaping the umlauts int he sql connection does not work. So far we weren't able to fully figure out under which conditions the umlauts are passed on correctly and under what conditions they aren't. Any pointers would be greatly appreciated. Thank you and kind regards Alexander ___ 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: Odd error logged when coming back from 'Browse All Versions'
Hi Graham, Right now, Versions doesn't bring back the inspectors automatically, but it may do so in the future. For now, bringing them back manually is the right thing. As for the logging, it's a known OS bug, but is basically harmless. Thanks. On Aug 23, 2011, at 8:08 PM, Graham Cox wrote: > My app has floating palettes. > > When I go to 'Browse All Versions...', these palettes get moved beyond the > edges of the screen. When I come back from browsing the versions, the > palettes are not there until I force then to show again using the > controller's -showWindow: method - they come back in the right place however. > In addition, I get this logged: > > Aug 24 12:59:44 Grahams-iMac Artboard[6712] : kCGErrorFailure: > CGSDisplayID: App trying to enumerate [0 to CGSGetNumberOfDisplays()] instead > of using CGSGetDisplayList(). Compensating... > Aug 24 12:59:44 Grahams-iMac Artboard[6712] : kCGErrorFailure: Set a > breakpoint @ CGErrorBreakpoint() to catch errors as they are logged. > > > So I tried to set a breakpoint on CGErrorBreakPoint() as suggested, and it's > never triggered. I can't find any reference to any of the mentioned functions > CGSDisplayID, CGSGetNumberOfDisplays or CGSGetDisplayList, and I'm not using > these directly anywhere. > > Any ideas? > > > --Graham___ > > 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/kperry%40apple.com > > This email sent to kpe...@apple.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: Preventing lion from saving state...
On Wed, 24 Aug 2011 08:56:49 +1000, Graham Cox said: >In Xcode 4, you can configure your scheme to have "disable state >restoration" checked. This suggests that there is a switch that can be >set that turns this off for an app, either as a defaults setting or >maybe as a command-line argument. Unfortunately I can't see exactly how >that works, but when the app launches, the log shows: > >23/08/11 1:12:19.951 PM Artboard: ApplePersistenceIgnoreState: Existing >state will not be touched. New state will be written to /var/folders/_d/ >fcb3h3892y339vh632v_hz28gn/T/com.mapdiva.as.Artboard.savedState > > >So perhaps 'ApplePersistenceIgnoreState' is a simple boolean in your >defaults that can be set? Worth a try… You can use it with Xcode 3 too, just pass it as a command line argument with value YES to your executable. But it's not something you should ship with, it's for debugging. Only windows associated with an NSDocument are restorable by default. It's much safer, as I described before, to just do: NSWindow* window = [inControllerToAdd window]; if ([window respondsToSelector:@selector(setRestorationClass:)] && [window respondsToSelector:@selector(setRestorable:)] && [window respondsToSelector:@selector(invalidateRestorableState)]) { [window setRestorationClass:Nil]; [window setRestorable:NO]; [window invalidateRestorableState]; } every time you add a window to your document. If you can require Xcode 4.1, you can also turn off the 'restorable' bool in IB's inspector for your document windows. But this may make your nibs not work with older tools, I'm not sure. I need to edit my nibs on 10.5, and so didn't go that route. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: Catching actions of fonts "Typography" panel
Delegate methods could be used if there is an editable textview. But what if not? For other things we have "changeFont:, changeColor:, changeAttributes:". Unfortunately, neither of them are called by action I have mentioned. Regards, Rimas M. On Wed, Aug 24, 2011 at 1:49 PM, Mike Abdullah wrote: > NSTextView has plenty of other delegate methods that will tell you why a > change is about to happen. Use those to decide how to handle after the > change has occurred. > > Sent from my iPad > > On 24 Aug 2011, at 11:39 AM, "Rimas M." wrote: > > > Hello folks, > > > > I am wondering - how it is possible to catch action, when sender is a > > Typography (the one that can be found in Fonts panels action menu at the > > left bottom side - http://db.tt/CC1hX8c )? If I have a text view with > > selection and I choose something in it (for example Alternative stylistic > > set for certain font), I am getting notification that text storage of > that > > text view has changed. That is way to abstract for my needs. Fair enough > > would be something like "font has changed". Or simply changeFont: for > first > > responder. > > > > By getting that action I would be able to implement that changes for any > of > > my views. Not only textview. > > > > Any thoughts? > > > > Best Regards, > > > > Rimas M. > > ___ > > > > 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/cocoadev%40mikeabdullah.net > > > > This email sent to cocoa...@mikeabdullah.net > ___ 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
Fwd: Can Peer-to-Peer Model Be Launched in AppStore?
Begin forwarded message: > From: Wayne J > Date: 2011年8月23日 上午04时57分32秒格林尼治标准时间+0800 > To: Bing Li > Subject: Re: Can Peer-to-Peer Model Be Launched in AppStore? > > Sorry, I missed you second question. > > If the iPad is making the connection then this should work on NAT but it > should also work on 3G. The only reason it would not work on 3G, that I can > think of, is that the carrier might block connections to specific ports on > outgoing. However, I don't think this is strictly point to point. If you > have 2 iPad talking to each other they are both behind NAT then they both > must connect to a server outside their NATs that will act as a sort of proxy. > > I believe that this is how Skype works. They just call the unknowing servers > 'supernodes'. This should also work over 3G unless that carrier blocks it > with a firewall or Apple disallows the application from the App store. But > neither of these reasons are technical in nature. > > > Wayne > > On Aug 22, 2011, at 10:26 AM, Bing Li wrote: > >> Dear Wayne, >> >> Thanks so much for your email! >> >> I don't understand your opinions well. Jens said 3G did not allow incoming >> connections. So I think P2P does not work in such an environment. I have to >> try to use app notifications. The major reason I use P2P is to get a lower >> load on the server and users can get pushed data. >> >> For iPad/iPhone within a NAT, I will ask the device to connect the server >> outside the NAT firstly. So a connection can be established. Pushing can be >> done without the block of NAT. >> >> Do you think my solution works? >> >> Best, >> Bing >> >> ___ 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
Fwd: Can Peer-to-Peer Model Be Launched in AppStore?
Begin forwarded message: > From: Wayne J > Date: 2011年8月23日 上午04时51分27秒格林尼治标准时间+0800 > To: Bing Li > Subject: Re: Can Peer-to-Peer Model Be Launched in AppStore? > > Unfortunately I cannot reply to the list right now because I don't have > things setup correctly. > > From a technical point of view there is nothing that does not allow this from > 3G. However, you will *not* be able to do this with a 3G connection. The > reason is that the carriers *will* have firewalls and probably *use* NAT. > Both of these can (and probably will) prevent direct point to point > connections. > > My point was that these things are *not* unique to 3G. You can encounter them > on any type of TCP/IP network connection so you application will have to deal > with them in all cases. I am not super familiar with BlueTooth but I am > pretty sure they are not issues with blue tooth. > > Wayne > > > On Aug 22, 2011, at 10:26 AM, Bing Li wrote: > >> Dear Wayne, >> >> Thanks so much for your email! >> >> I don't understand your opinions well. Jens said 3G did not allow incoming >> connections. So I think P2P does not work in such an environment. I have to >> try to use app notifications. The major reason I use P2P is to get a lower >> load on the server and users can get pushed data. >> >> For iPad/iPhone within a NAT, I will ask the device to connect the server >> outside the NAT firstly. So a connection can be established. Pushing can be >> done without the block of NAT. >> >> Do you think my solution works? >> >> Best, >> Bing >> >> ___ 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: Is there any API to detect the WIFI/CELL Signal Strength
CoreWLAN.framework isn't available for iOS (FYI). There is an open radar on this issue in the hopes to bring something to iOS. There is WifiManager for Android and people complaining about something like that not being available for Apple devices. - Eric On Wed, Aug 24, 2011 at 5:10 AM, Stephane Sudre wrote: > There are both supported and private APIs to get this kind of data. > > In Mac OS X 10.6 and later, check the CoreWLAN.framework. > > On Wed, Aug 24, 2011 at 5:19 AM, Jens Alfke wrote: > > > > On Aug 23, 2011, at 5:38 PM, Sasikumar JP wrote: > > > >> For my education, could you let me know,if there is any API to get the > WIFI/CELL signal strength. > > > > At some level there probably is. I have no idea whether it’s private or > not. (Particularly on iOS, which exposes a lot fewer system-level APIs than > Mac OS.) And it’s definitely going to be something down at the kernel or > IOKit level, not in Cocoa, so I’ll bet you the people who know the answer > aren’t on this mailing list. > > > > http://lists.apple.com has a list of dozens of Apple developer mailing > lists; take a look and see if there’s one that seems relevant. > > > > —Jens___ > ___ > > 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/edolecki%40gmail.com > > This email sent to edole...@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: Catching actions of fonts "Typography" panel
NSTextView has plenty of other delegate methods that will tell you why a change is about to happen. Use those to decide how to handle after the change has occurred. Sent from my iPad On 24 Aug 2011, at 11:39 AM, "Rimas M." wrote: > Hello folks, > > I am wondering - how it is possible to catch action, when sender is a > Typography (the one that can be found in Fonts panels action menu at the > left bottom side - http://db.tt/CC1hX8c )? If I have a text view with > selection and I choose something in it (for example Alternative stylistic > set for certain font), I am getting notification that text storage of that > text view has changed. That is way to abstract for my needs. Fair enough > would be something like "font has changed". Or simply changeFont: for first > responder. > > By getting that action I would be able to implement that changes for any of > my views. Not only textview. > > Any thoughts? > > Best Regards, > > Rimas M. > ___ > > 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/cocoadev%40mikeabdullah.net > > This email sent to cocoa...@mikeabdullah.net ___ 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
Catching actions of fonts "Typography" panel
Hello folks, I am wondering - how it is possible to catch action, when sender is a Typography (the one that can be found in Fonts panels action menu at the left bottom side - http://db.tt/CC1hX8c )? If I have a text view with selection and I choose something in it (for example Alternative stylistic set for certain font), I am getting notification that text storage of that text view has changed. That is way to abstract for my needs. Fair enough would be something like "font has changed". Or simply changeFont: for first responder. By getting that action I would be able to implement that changes for any of my views. Not only textview. Any thoughts? Best Regards, Rimas M. ___ 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: Is there any API to detect the WIFI/CELL Signal Strength
There are both supported and private APIs to get this kind of data. In Mac OS X 10.6 and later, check the CoreWLAN.framework. On Wed, Aug 24, 2011 at 5:19 AM, Jens Alfke wrote: > > On Aug 23, 2011, at 5:38 PM, Sasikumar JP wrote: > >> For my education, could you let me know,if there is any API to get the >> WIFI/CELL signal strength. > > At some level there probably is. I have no idea whether it’s private or not. > (Particularly on iOS, which exposes a lot fewer system-level APIs than Mac > OS.) And it’s definitely going to be something down at the kernel or IOKit > level, not in Cocoa, so I’ll bet you the people who know the answer aren’t on > this mailing list. > > http://lists.apple.com has a list of dozens of Apple developer mailing lists; > take a look and see if there’s one that seems relevant. > > —Jens___ ___ 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