Re: NSScrollView Problems
Ok, I just checked my code and I found exactly that. I had a conditional statement that wasn't balanced with a [NSGraphicsContext restoreGraphicsState]. I should of immediately thought of that as too many things were not operating correctly. The biggest problem was that I didn't see these errors on my machine. I only saw them on other machines. The scroll bar errors only appeared on certain OSes like 10.6 and 10.8, but not on 10.7. Thanks for everyone's input. On Feb 02, 2013, at 09:58 PM, Kyle Sluder wrote: Unbalanced +[NSGraphicsContext saveGraphicsState] in your custom view's -drawRect? (Or in one of its subviews'?) --Kyle Sluder On Feb 2, 2013, at 9:19 PM, Patrick Cusack wrote: You can see an example of the problem here: http://i45.tinypic.com/fu8bpz.png On Feb 2, 2013, at 8:06 PM, Graham Cox wrote: On 03/02/2013, at 1:59 PM, Patrick Cusack wrote: Sorry, I have asked this before, but I am genuinely perplexed and need help. I have an NSScrollView enclosing a custom view. When, I launch my application, I see the scroll bars of my NSScrollView being echoed or duplicated in the middle of my custom view. It is so annoying. I have tried everything I can to figure out why it is doing it. Has anyone ever seen this? I have been slowly pulling things out of my model, but the only thing that keeps it from happening, is if I completely hide the scrollbars, but then I need to add logic to scroll the view inside the scrollview. Well, I've never seen this happen despite using NSScrollView extensively. So that suggests that there is something a bit strange with the way you're creating it, or setting it up. In IB, you can either add a scroll view than add a custom view to it, or add a custom view and then use 'Embed in Scrollview' to wrap it in the scrollview. Both work fine for me. The next thing to check is the sizing settings. Are you using classic springs and struts or the newer constraints? I'm afraid I don't yet have any experience with the new thing, only springs and struts. The scroller should usually be set to expand and stick to all four sides of its enclosing view, but the custom view within is usually of a fixed size, and this might change programmatically according to your content. There's no reason to change any other setting, such as the scrollbars or the clip view of the scrollview. Whether your custom view is flipped or not will affect the way the scrollview behaves - something to check. Does anything in your code "fiddle" with the scrollview? There is rarely a need to. Have you subclassed it, and overridden something like -tile? You could try starting a fresh project and quickly trying to put together a simple scrollview without any special code and verify it works, then look for what difference there is in your project that changes that. --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: https://lists.apple.com/mailman/options/cocoa-dev/kyle%40ksluder.com This email sent to k...@ksluder.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data & NSPersistentDocument & Concurrency
On 3 Feb 2013, at 01:04, Eric Gorr wrote: > > On Feb 1, 2013, at 6:59 PM, Mike Abdullah wrote: > >> On 1 Feb 2013, at 20:13, mail...@ericgorr.net wrote: >> >>> I've got a NSPersistentDocument. I have read the Concurrency with Core Data >>> in the Core Data Programming Guide and am following the typically >>> recommended approach which is to create separate managed object context >>> (MOC) for each thread, but to share a single persistent store coordinator >>> (PSC) >>> >>> I am using a NSOperation which does create its own MOC and does share the >>> PSC with the main thread. The operation adds some objects and I call [MOC >>> save:&error]. This succeeds and a NSManagedObjectContextDidSaveNotification >>> is generated and I get this on the main thread. I then call the >>> mergeChangesFromContextDidSaveNotification method while handling the >>> notification on the main thread. I can see the objects saved in my document. >>> >>> The problem then is that my NSPersistentDocument generates an error which >>> says: >>> >>> "The document "xxx" could not be saved. The file has been changed by >>> another application" >>> >>> Of course, the other application is the NSOperation which did change the >>> document. >>> >>> How can I correctly avoid the error? >> >> The problem here is you're modifying the document on disk behind >> NSDocument's back. This has the immediate consequence of changing the >> modification date. But it also has subtler ramifications from sidestepping >> NSFileCoordinator and Versions. >> >> On OS X 10.7, Core Data offers child contexts. You could setup your >> background contexts to be children of the main one. This way when they save, >> they would only be saving back into the main context, without touching the >> store on disk. > > Well, my first problem is that I currently need to support 10.6, but for > various reasons I may suggest changing that to 10.7. On 10.6, your only option is to share the same PSC directly, and update the document's modification date when saving. Happily, 10.6's saving model is a lot simpler than 10.7+ > >> One downside of that is whenever a child needs to fetch data, it must do so >> via the main context, blocking the main thread while doing so. Depending on >> your model, that may prove unacceptable. If so, your better bet is to have a >> single "root" context with its own private queue. Make the main context a >> child of it. And then also make any background contexts children of it. >> At that point, you start to leave NSPersistentDocument's remit. I have code >> here demonstrating how to do subclass NSDocument directly for this setup: > > Interesting solution. Yes, blocking the main thread is not an option for me. Well bear in mind it should only be a problem if either: A) you've got fetch requests to execute that take a long time B) you're executing many requests, one after another If your uses case is more to do some sort of long-winded processing on a background thread and save the results, then there shouldn't be a problem. > > I am a bit surprised that such basic functionality is supported directly > somehow. NSPersistentDocument is old and unloved, is about all it comes down to. > >> https://github.com/karelia/BSManagedDocument >> (make sure you checkout the ksmanageddocument branch!) >> >> One great advantage is it leverages the root context to implement >> asynchronous saves. Out of the box it is designed to match >> UIManagedDocument's document package layout, but I'm sure you could adjust >> that. Or perhaps just re-use bits of the code in your NSPersistentDocument >> subclass. > > If I understand this correctly, BSManagedDocument is a complete drop-in > replacement for NSPersistentDocument? No it's a drop-in implementation of UIManagedDocument for OS X. As such it specifically targets creating document packages. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform)
On 3 Feb 2013, at 07:41, 尹佳冀 wrote: > Hi All > > Does anyone can know what the difference between [NSOperationQueue > currentQueue] and > performSelectorOnMainThread, If I do some work use operation > on [NSOperationQueue mainQueue], the UI will not hang up, but if i > use performSelectorOnMainThread the UI will hang up > > - (void) doTheThing > > { > > //Do do some work about 9~20 s > > } > > > [self showIndicatorWithString:NSLocalizedString(@"Doing...", nil)]; > // is a MBProgreessHUD, add a view then use a animation to show > >//Case 4 not hang up, HUD show and can refresh, but the screen > cannot response user's touch > >NSInvocationOperation *operation = [[NSInvocationOperation alloc] > initWithTarget:self > > >selector:@selector(doTheThing) > > > object:nil]; > >[[NSOperationQueue mainQueue] addOperation:operation]; This causes -doTheThing to run on the main thread, a little later than now > >//Case 2 hang up, HUD not show > >//[self doTheThing]; This executes -doTheThing immediately, on whatever thread is the current one >//Case 3 hang up, HUD not show > >//[self performSelectorOnMainThread:@selector(doTheThing) > withObject:nil waitUntilDone:YES]; This executes -doTheThing immediately, on the main thread > >//Case 4 not hang up, HUD show and can refresh, but the screen > cannot response user's touch > > NSInvocationOperation *operation = [[NSInvocationOperation alloc] > initWithTarget:self > > >selector:@selector(doTheThing) > > > object:nil]; > >[[NSOperationQueue currentQueue] addOperation:operation]; All depends on what's the current queue at the moment. If this code is running on the main thread, it'll be the main queue. If this code is running as part of an operation on a queue, it'll be that queue. Otherwise, it's fairly undefined, and might well return nil, meaning your code never runs. It seems you need to take the time to learn a little about how multithreading works and should be used with Cocoa. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString and file system Re: AppleScript in Sandboxed App
Hello, On Wed, 16 Jan 2013 17:12:15 +, jonat...@mugginsoft.com wrote: On 16 Jan 2013, at 15:50, Fritz Anderson wrote: On 16 Jan 2013, at 3:52 AM, "jonat...@mugginsoft.com" wrote: Py_SetProgramName((char *)[[scriptRunner launchPath] UTF8String]); If a char* is destined for the file system, you should be using -fileSystemRepresentation, not -UTF8String. I forget that all the time. To be honest I rarely remember to call -fileSystemRepresentation. The docs seem to indicate that its only purpose is to replace abstract / and . characters with OS equivalents. On OS X this would have seem to have no net result. Is there more to this? For some codepoints (e.g. umlauts) there is more than one way to represent them in Unicode (composed/decomposed): NSString *str = @"/äöü.txt"; const char *utf8 = [str UTF8String]; const char *file = [str fileSystemRepresentation]; NSLog(@"utf8: %zd %s", strlen(utf8), utf8); NSLog(@"file: %zd %s", strlen(file), file); Results (depending on the filesystem, I guess) in: UTFFilename[6260:403] utf8: 11 /.txt UTFFilename[6260:403] file: 14 /.txt Think of it as "umlaut-a/o/u" vs. "a/o/u, as umlaut" Both encodings work but e.g. SVN has (had) problems with files that contain umlauts: They used the composed name internally but the filesystem returns the decomposed variant on OS X. Blindly comparing the UTF-8 byte arrays failed. Bye, Daniel ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: book for n00b
If author is not an issue, I find "Programming in Objective-C" written by Stephen G. Kochan to be a fantastic book, covering tons of topics, and wouldn't be too tough for a novice to dive into. Hope this helps!! Thanks, Andrew Coleman On Jan 16, 2013, at 13:14, Scott Ribe wrote: > I know someone who's developed an interest in developing for Mac. No > programming experience, some HTML, so classic newbie. > > Would Hillegass' book still be the best intro? > > -- > Scott Ribe > scott_r...@elevated-dev.com > http://www.elevated-dev.com/ > (303) 722-0567 voice > > > > > > ___ > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/a.coleman%40me.com > > This email sent to a.cole...@me.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
new to Cocoa/Objective-c: many points of confusion
Hello all, First, I will quickly give my background. I graduated two years ago with a computer science degree and a math minor; my education focused mostly on Java, Python, and some web languages, with bits of several other languages thrown in from time to time. I understand the concepts of modern programming (methods, classes, objects, inheritance, all that) quite well thanks to that degree, but we never delved much into C-style languages. Now, I am trying to teach myself Objective-c, with the goal of writing some Mac and/or iOS apps (Mac ones first). I should also say that I am blind, relying on Apple's Voiceover screen reader to use my mac and iPhone. As of right now, making connections in IB is basically inaccessible to Voiceover; I can lay out my UI, but not connect anything to code, so I am working on understanding the theory at this point until Apple fixes IB. For what it is worth, my eventual goal is to release some common games for Apple devices that are currently ubiquitous, such as Solitaire, but that have no blind-accessible versions in either App Store (imagine no Solitaire on your iPhone!). For the purposes of learning, though, I am trying to work through Apple's Trackmix example, while learning OpenAL on the side and having a peek at how to write a synthesizer plugin using Apples Morse Synthesizer as a reference. My main focus, of course, is on the Trackmix tutorial and on learning the concepts behind it, though the afore-mentioned limitations of IB have me stuck for now. Now that that's done, let's get started. I apologize in advance if any of the below are considered off-topic for this list. Please let me know which of my questions belong on another list and I will take them there instead. *delegates: my understanding is that these take the place of subclasses (though why this is useful is beyond me), overriding methods they are designed to handle rather than letting the base class take those methods. However, I not only don't see why this is so great, but I don't understand the syntax used to declare them or attach them to other classes so the delegates' methods get called when any of those methods are called on the object to which the delegate is attached. Every example I have found seems to indicate they are used only for GUIs, but Apples docs say that they are a much more general-purpose system? *Speaking of delegates, I don't follow the syntax used to set them up. Every example seems to love to use views or other UI examples, which would be fine if I could follow that, but I'm not that advanced yet. A more basic, even if not-so-useful-in-reality, example would be very much appreciated. *Outlets: I have a basic idea that these are a way of sending messages from object to object, a bit like listeners. However, I don't really understand the syntax used to make them. Moreover, I always see them used in GUIs, but Xcode's Interface Builder won't let Voiceover users make connections, so I can't proceed with Apple's tutorials on this topic. Somehow, these connections are outlets, or are related to outlets, or some connections are outlets, or something... Anyway, as I can't make the connections to get an idea of how they work, I'm trying to follow others' examples which I don't get as they use code I didn't write and that makes no sense to my newbie brain. So, what exactly is an outlet and how and why would I set one up? Again, a very basic code example would really help here. *Every so often I'll see a class between less- and greater-than signs when an example talks about a delegate, but I don't know what this is for. What does it mean to put these symbols around a class (or maybe they are around an object?)? *I've seen sample code that seems to go against everything I know about method calls: -(IBAction) someObject:(id)inSender; Huh? Is the (IBAction) casting, or a method call, or what (I understand what IBAction is, but not why it is where it is and in parentheses)? I know why the "id" is there, so this action will work with any UI element, but why the colon? What is inSender doing there, hanging out at the end of the line? How does the method (in the m file) have any idea what inSender is as it appears to not be an argument? Why does it need inSender if it already has the id argument? *What is a property? I see these used a lot, but I'm not clear on what they are compared to, say, class-level variables or methods. The statement I'm talking about is the "@property" statement. *I know that using the @synthesize statement auto-generates getters and setters, but no one ever talks about how to use them once they are set up. That is, what is the syntax for these generated methods? I assume it is "get" and "set", cammel-cased with the variable being synthesized (and with a single parameter matching the variable type in the case of the setter) but I want to be sure. Thanks in advance for any information. Oh, and yes, I have already
NSOutlineView -reloadItem: vs insertItemsAtIndexes:inParent:withAnimation:
Hi there, I've been having intermittent unexplained out of bounds errors when inserting new items into an NSOutlineView. Here's a snippet from my controller's update method (triggered by a KVO notification) that should explains the sort of problem I've been having. This class it's from is the delegate and data source for the outline view. if ([insertedSet count] > 0) { NSIndexSet* insertedIndexes = [newContentArray indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { return [insertedSet containsObject:obj]; }]; NSLog(@"%d", (int)[self outlineView:_outlineView numberOfChildrenOfItem:parentItem]); // => 1 NSLog(@"%@", insertedIndexes); // => { 1 } [_outlineView insertItemsAtIndexes:insertedIndexes inParent: parentItem withAnimation:NSTableViewAnimationSlideDown]; // => Exception here } The exception I'm getting is "NSOutlineView error inserting child indexes [number of indexes: 1 (in 1 ranges), indexes: (1)] in parent 0x101850920 (which has 0 children)". So it looks like NSOutlineView's internal state is somehow getting out of sync with my controller class. I think I have it tracked down to the fact that I didn't want the first bunch of content displayed to animate in, so I had the following at the beginning of the method: if (_flags.isSettingContent) { [_outlineView reloadItem:parentItem]; return; } Replacing it with: if (_flags.isSettingContent) { [_outlineView insertItemsAtIndexes:insertedIndexes inParent:parentItem withAnimation:NSTableViewAnimationEffectNone]; return; } seems to fix the problem. Problem is, I'm not sure why it fixes it... A simple test case didn't seem to reproduce the issue. Has anyone noticed any differences in behaviour between these two ways of updating an outline view? Thanks Chris ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
-mouseDragged: invoked when it should not (and without mouseDown)
Hi, guys. I need some help in event handling. I have a custom view embedded in a scroll view which is embedded in a split view. The window has got a toolbar. When I move the window down by dragging the toolbar, very often the -mouseDragged: of my custom view gets invoked. Curiously enough, it does not seem to happen when I drag the window up. My questions: - Why? - When I NSLog() things, I see that -mouseDown: of the custom view is not invoked. What's going on? It's the following file https://github.com/qvacua/qmind/blob/master/Qmind/QMMindmapView.m from line 706. I created a dummy project which has got a dummy -mouseDragged: implementation inside a window with a toolbar. In the dummy project it does not happen at all. I'm clueless. Am I missing something quite simple here? Anybody had similar problems? Thanks in advance. Best, Tae -- http://qvacua.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTableView and performClickOnCellAtColumn - cannot make it work
Hi group, I am trying to use performClickOnCellAtColumn on NSTableView to put cell in editing mode (like when you create a new folder in Finder). If I click on the cell I can change it content but using performClickOnCellAtColumn nothing happens. This is the code I am using: - (IBAction)someAction:(id)sender { [leftTblView performClickOnCellAtColumn:1 row:2]; } How can I troubleshoot this issue? BR, Ivan ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSDocument packages and incremental writing using NSFileWrapper
Hello, My NSDocument based app uses packages with the following structure: - document.package +- metadata.plist (small, mutable) +- large0.file (large, immutable) +- large1.file (large, immutable) +- large2.file (large, immutable) While the metadata.plist file can change any time, all large files are created once and then stay as they are. As my "large0-2" files can be several gigabytes, I try to carefully avoid unnecessary IO by using document packages with NSFileWrapper. My package reading/writing methods resemble the ones in the "Document Package with iCloud" sample (But I don't use iCloud): http://developer.apple.com/library/mac/#samplecode/PackagedDocument/ I appended the relevant parts of my code at the end of this message. With this setup, I was hoping that the occasions where the document architecture has to copy the whole bundle are reduced to: - File duplication - Moves to another volume But after investigating file activity with Instruments.app, it turned out that my app is reading and writing chunks of my unmodified, immutable & large files during each save. It seems that the copying is related to document revisions (a.k.a. Versions). Instruments logs hundreds of IO operations in the form of: # Caller FunctionFD PathBytes ... 70 copyfileread22 document.package/large0.file1048576 71 copyfilewrite 23 /.vol/16777218/2/.DocumentRevisions-V100/staging/adding.Wohcjo4i/4772FAAA-78D3-44A9-9412-A2D651B6EB5A.package/large0.file 1048576 70 copyfileread22 document.package/large0.file1048576 71 copyfilewrite 23 /.vol/16777218/2/.DocumentRevisions-V100/staging/adding.Wohcjo4i/4772FAAA-78D3-44A9-9412-A2D651B6EB5A.package/large0.file 1048576 70 copyfileread22 document.package/large0.file1048576 71 copyfilewrite 23 /.vol/16777218/2/.DocumentRevisions-V100/staging/adding.Wohcjo4i/4772FAAA-78D3-44A9-9412-A2D651B6EB5A.package/large0.file 1048576 ... How can I tell Versions that the only file that constantly changes within my document.package is metadata.info? (Without turning off document revisions altogether) I am targetting 10.8 (with sandboxing enabled) and also adopted async saving and autosavesInPlace. with kind regards, Thomas --- - (NSFileWrapper*)fileWrapperOfType:(NSString*)typeName error:(NSError**)outError { if([self documentFileWrapper] == nil) { NSFileWrapper* documentFileWrapper = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:nil]; [self setDocumentFileWrapper:documentFileWrapper]; [documentFileWrapper release]; } NSURL* documentURL = [self fileURL] == nil ? [self autosavedContentsFileURL] : [self fileURL]; if(documentURL) { //Check if we already have a metadata file wrapper. If "YES" remove it. NSFileWrapper* previousRecordingInfoFileWrapper = [[[self documentFileWrapper] fileWrappers] objectForKey:kSSWInfoPlistFilename]; if(previousRecordingInfoFileWrapper != nil) { [[self documentFileWrapper] removeFileWrapper:previousRecordingInfoFileWrapper]; } NSData* recordingInfoData = [NSPropertyListSerialization dataFromPropertyList:recordingInfoDict format:NSPropertyListXMLFormat_v1_0 errorDescription:&serializationErrorDescriptions]; [self unblockUserInteraction]; NSFileWrapper* recordingInfoFileWrapper = [[NSFileWrapper alloc] initRegularFileWithContents:recordingInfoData]; [recordingInfoFileWrapper setPreferredFilename:kSSWInfoPlistFilename]; [[self documentFileWrapper] addFileWrapper:recordingInfoFileWrapper]; [recordingInfoFileWrapper release]; if(([[[self documentFileWrapper] fileWrappers] objectForKey:kSSWRecordingFrameName] == nil)) { NSFileWrapper* frameFileWrapper = [[NSFileWrapper alloc] initWithURL:[documentURL URLByAppendingPathComponent:kSSWRecordingFrameName] options:0 error:outError]; [frameFileWrapper setPreferredFilename:kSSWRecordingFrameName]; [[self documentFileWrapper] addFileWrapper:frameFileWrapper]; [frameFileWrapper release]; } ... } } - (BOOL)readFromFileWrapper:(NSFileWrapper *)fileWrapper ofType:(NSString *)typeName error:(NSError **)outError { BOOL didRead = NO; NSFileWrapper* recordingInfoWrapper = [[fileWrapper fileWrappers] objectForKey:kSSWInfoPlistFilename]; if(!recordingInfoWrapper) { NSMutableDictionary* errorDetail = [NSMutableDictionary dictionary]; NSString* errorDescription = NSLocalizedString(@"Could not open recording.\nThe recording is missing it's metadata file.", @"Displayed when trying to open a corrupted bundle"); [errorDetail setValue:errorDescription forKey:NSLocalizedDescriptionKey]; if(outError) { *outError = [NSError error
Re: Localization not working based on region with en-US, en-UK and en lproj
> My project has > 1. en_GB.lproj > 2. en_US.lproj > 3. en.lproj > Directories. Each time even if I change region setting, always strings from > en.lproj directory is displayed. > Are you relaunching your application between changes to the region? Does your application’s preference domain have an overridden AppleLanguages or AppleLocale value? What is the output of these commands: defaults read -g AppleLanguages defaults read -g AppleLocale defaults read $YOUR_BUNDLE_IDENTIFIER AppleLanguages defaults read $YOUR_BUNDLE_IDENTIFIER AppleLocale replacing the bundle identifier in the second as appropriate Cheers, Keith ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: new to Cocoa/Objective-c: many points of confusion
> *delegates: my understanding is that these take the place of subclasses > (though why this is useful is beyond me), overriding methods they are > designed to handle rather than letting the base class take those methods. > However, I not only don't see why this is so great, but I don't understand > the syntax used to declare them or attach them to other classes so the > delegates' methods get called when any of those methods are called on the > object to which the delegate is attached. Every example I have found seems to > indicate they are used only for GUIs, but Apples docs say that they are a > much more general-purpose system? > *Speaking of delegates, I don't follow the syntax used to set them up. Every > example seems to love to use views or other UI examples, which would be fine > if I could follow that, but I'm not that advanced yet. A more basic, even if > not-so-useful-in-reality, example would be very much appreciated. Delegates are indeed a general-purpose pattern -- there are many instances of non-GUI classes that use the delegate pattern in the Foundation framework (note that the Foundation framework doesn't include any GUI functionality, that's all in the AppKit and UIKit frameworks.) For example, NSFileManager, NSCache, NSPort, and NSURLConnection all expose delegate interfaces. The delegate pattern is simply a callout mechanism, allowing one class to notify another class of some event. The delegate pattern is inherently limited in that only one delegate can typically be assigned to a class, but often that limitation isn't an issue. In contrast to this limitation, notifications (via NSNotificationCenter) are an alternative callout mechanism that are useful in cases where a class might expect more than one client to be interested in an event. A delegate is always an object, and with modern Objective-C, classes typically declare a delegate protocol with required and optional methods for the delegate object to implement. For example, NSFileManager declares the NSFileManagerDelegate protocol. Now say I have a class called MyFileDelegate; in the interface for MyFileDelegate, I declare that it conforms to the NSFileManagerDelegate protocol: @interface MyFileDelegate @end Now say I assign an instance of MyFileDelegate to be the delegate of an instance of NSFileManager, via NSFileManager's -setDelegate: method. Once that's set up, any time I, for example, move a filesystem object using that NSFileManager instance, that same MyFileDelegate instance is notified via the -fileManager:shouldMoveItemAtPath:toPath: method, which MyFileDelegate implements. > *Outlets: I have a basic idea that these are a way of sending messages from > object to object, a bit like listeners. However, I don't really understand > the syntax used to make them. Moreover, I always see them used in GUIs, but > Xcode's Interface Builder won't let Voiceover users make connections, so I > can't proceed with Apple's tutorials on this topic. Somehow, these > connections are outlets, or are related to outlets, or some connections are > outlets, or something... Anyway, as I can't make the connections to get an > idea of how they work, I'm trying to follow others' examples which I don't > get as they use code I didn't write and that makes no sense to my newbie > brain. So, what exactly is an outlet and how and why would I set one up? > Again, a very basic code example would really help here. I think you've somewhat misunderstood outlets: outlets are references to objects created in IB. (These objects are typically UI-related, such as views and buttons.) Outlets can be either an instance variable or a property. Now let's say we have a view controller with an outlet (in the form of an instance variable) to a button that exists inside the view. The view controller's interface might look like: @interface MyViewController : UIViewController { IBOutlet UIButton *myButton; } @end If I hook up the outlet correctly in IB, every time I instantiate MyViewController, its 'myButton' instance variable references the button that exists in its view. > *Every so often I'll see a class between less- and greater-than signs when an > example talks about a delegate, but I don't know what this is for. What does > it mean to put these symbols around a class (or maybe they are around an > object?)? There are two different scenarios in which you'll encounter these less-than/greater-than signs in Objective-C, and both concern the protocols feature of Objective-C. The first situation is in class interfaces, where they're used to declare that whatever class you're creating conforms to the protocol between the less-than/greater-than signs. Let's continue with NSFileManager to illustrate: NSFileManager declares the NSFileManagerDelegate protocol. So let's declare a class called AppController that conforms to NSFileManagerDelegate; the syntax looks like: @interface AppController @end The second situation that you'll encoun
Re: Localization not working based on region with en-US, en-UK and en lproj
Yes i am launching the the application between changes to the region. Not sure what is Application's preference domain? How can we set/unset this? The output of the defaults command as below. *$ defaults read com.yourcompany.Hello AppleLanguages* 2013-02-03 20:22:10.317 defaults[4084:903] The domain/default pair of (com.yourcompany.Hello, AppleLanguages) does not exist *$ defaults read com.yourcompany.Hello AppleLocale* 2013-02-03 20:22:13.093 defaults[4085:903] The domain/default pair of (com.yourcompany.Hello, AppleLocale) does not exist * $ defaults read -g AppleLanguages* ( en, fr, de, ja, es, it, pt, "pt-PT", nl, sv, nb, da, fi, ru, pl, "zh-Hans", "zh-Hant", ko ) *$ defaults read -g AppleLocale* en_US On Sun, Feb 3, 2013 at 7:39 PM, Keith Duncan wrote: > > My project has > > 1. en_GB.lproj > > 2. en_US.lproj > > 3. en.lproj > > Directories. Each time even if I change region setting, always strings > from en.lproj directory is displayed. > > > Are you relaunching your application between changes to the region? > > Does your application’s preference domain have an overridden > AppleLanguages or AppleLocale value? > > What is the output of these commands: > > defaults read -g AppleLanguages > defaults read -g AppleLocale > > defaults read $YOUR_BUNDLE_IDENTIFIER AppleLanguages > defaults read $YOUR_BUNDLE_IDENTIFIER AppleLocale > > replacing the bundle identifier in the second as appropriate > > Cheers, > Keith > > ___ > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/arun.ka%40gmail.com > > This email sent to arun...@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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: MIDIClientCreate fail
On Feb 2, 2013, at 11:20 PM, Ben wrote: > (Sorry for the repost, I forgot to change the title) > > Hi, I'm mighty confused by the following code. When I run this in one project > it works fine, when I run it in another one it crashes. > Both projects appear identical in terms of frameworks CoreAudio, > CoreFoundation, CoreMIDI, AudioToolbox, Both target iOS 6 iPad Simulator. > Though clearly something differs. > > > > Fails with: > > 2013-02-03 04:53:59.229 Project[1398:c07] viewDidLoad > 2013-02-03 04:53:59.896 Project[1398:c07] *** Assertion failure in -[BMAudio > midiTest], /Users/me/Documents/sites/Project/Project/Project/BMAudio.m:63 > 2013-02-03 04:53:59.898 Project[1398:c07] *** Terminating app due to uncaught > exception 'NSInternalInconsistencyException', reason: 'MIDIDestinationCreate > failed. Error code: -10844 '§’ˇˇ'' > *** First throw call stack: > (0x161012 0x1888e7e 0x160e78 0x131ef35 0xc298 0x2a50 0x8b1817 0x8b1882 > 0x80ad99 0x7d42a0 0x81b6b7 0x81b8c6 0x7d420b 0x7d42dd 0x7d446c 0x27a8 > 0x7cd7b7 0x7cdda7 0x7cefab 0x7e0315 0x7e124b 0x7d2cf8 0x206fdf9 0x206fad0 > 0xd6bf5 0xd6962 0x107bb6 0x106f44 0x106e1b 0x7ce7da 0x7d065c 0x26fd 0x2625) > libc++abi.dylib: terminate called throwing an exception > > > Any ideas? > The code…. [snip] This Stack Overflow post may help explain the error and point out the possible difference between the two projects: http://stackoverflow.com/questions/12548856/coremidi-pgmidi-virtual-midi-error-in-ios6 ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTableView and performClickOnCellAtColumn - cannot make it work
On Jan 26, 2013, at 4:08 AM, Ivan Ostres wrote: > I am trying to use performClickOnCellAtColumn on NSTableView to put cell in > editing mode (like when you create a new folder in Finder). If I click on the > cell I can change it content but using performClickOnCellAtColumn nothing > happens. This is the code I am using: > > - (IBAction)someAction:(id)sender { NSLog(@"In someAction: %@", leftTblView); >[leftTblView performClickOnCellAtColumn:1 row:2]; > } > > How can I troubleshoot this issue? For starters, add a log statement like the one above (or set a breakpoint) and make sure that the method is being called and that leftTblView is properly connected/set. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: new to Cocoa/Objective-c: many points of confusion
Hi Alex, Lots of basic topics here that I love to talk about. I'll just focus on delegates, at least for now. On Jan 21, 2013, at 10:10 PM, Alex Hall wrote: > *delegates: my understanding is that these take the place of subclasses > (though why this is useful is beyond me), overriding methods they are > designed to handle rather than letting the base class take those methods. > However, I not only don't see why this is so great, but I don't understand > the syntax used to declare them or attach them to other classes so the > delegates' methods get called when any of those methods are called on the > object to which the delegate is attached. Every example I have found seems to > indicate they are used only for GUIs, but Apples docs say that they are a > much more general-purpose system? > > *Speaking of delegates, I don't follow the syntax used to set them up. Every > example seems to love to use views or other UI examples, which would be fine > if I could follow that, but I'm not that advanced yet. A more basic, even if > not-so-useful-in-reality, example would be very much appreciated. Comparing delegation to subclassing is exactly the right question. In both cases you'd like to change some aspect of how an object behaves. To do this with a subclass, as you're used to, you override some method and put the desired behavior there. Sometimes that method is one you will call yourself. Sometimes it is one that you'll *never* call yourself, but gets called for you in the course of the object's lifetime. It depends on the method, in Cocoa as in Java. To use delegation, you put the special behavior in a method of a *different* object which you designate as the first object's delegate. To connect the delegate in code (as opposed to Interface Builder) the method is almost always called setDelegate:. You're just setting an instance variable using a setter method, just as you would do in Java. You typically don't call a delegate method directly. Delegate methods are typically called by the object itself, at various points in its lifetime. Often they're called just before or after the object does something, hence the "willDoSomething" and "didDoSomething" pattern in many delegate method names. A simple non-visual example that might help is is NSSound, which has just one delegate method called sound:didFinishPlaying:. Here's a quick example of creating an instance of NSSound and giving it a delegate. * In Xcode, create a new project of type "Cocoa application". * In AppDelegate.m, add these lines to the applicationDidFinishLaunching: method that has been pre-supplied for you. NSSound *sound = [NSSound soundNamed:@"Tink"]; [sound setDelegate:self]; [sound play]; * In the same file add the following method to the AppDelegate class: - (void)sound:(NSSound *)sound didFinishPlaying:(BOOL)finishedPlaying { NSLog(@"sound finished"); } Run the app. (You'll get a compiler warning which you can ignore for now.) You should hear a "Tink" sound (it's one of the built-in sounds in Cocoa), and in the Xcode Console pane you should see the words "sound finished". So, why would you do things this way instead of subclassing NSSound and overriding the "play" method? * Separation of concerns. Cocoa is big on separation of concerns. Suppose, instead of simply logging a message, you wanted to do some things in the UI when the sound finishes playing. Maybe you want to change a text field to say "The sound finished playing!" Maybe your UI has a Play/Stop button that shows different icons when the sound is playing and when it's not. It doesn't make sense for an NSSound subclass to know about user interface. You'd put all that behavior in a delegate object that *does* know about user interface, and point the NSSound to that delegate. (The delegate would almost certainly be a "Controller" in the MVC paradigm, which Cocoa is very big on.) * Delegates are inherited by subclasses. It's been said that delegation means you don't have to subclass, but it happens to provide a benefit when you *do* subclass. Suppose there were three subclasses of NSSound, any of which might get used (unpredictably) at runtime. With delegation, you're able to specify this custom behavior regardless of which subclass gets used. You can add more subclasses and they'll inherit this delegation ability as well. Cocoa delegate methods follow well-defined conventions. For example, notice the "did" in "sound:didFinishPlaying:". As I mentioned, "did" and "will" are commonly used in delegate method names. Also note that the first argument to sound:didFinishPlaying: is an NSSound. All proper Cocoa delegate methods are structured this way. There may be cases where your delegate method cares *which* sound object is doing the delegation. For example, you might want to print the name of the sound by modifying the delegate method like this: - (void)sound:(NSSound *)sound didFinishPlaying:(BOOL)finishedP
Re: Cocoa-dev Digest, Vol 10, Issue 76
From the compiler standpoint though, IBAction is equivalent to "void", so let's just assume the method in question reads like the following, and we'll break it down: -(void)someMethod: (id)inSender; ... 3. someMethod: this is the name of the method Care needs to be take here. The name of the method is "someMethod:" rather than "someMethod"; the colon, as subsequently noted, does indicate the presence of a parameter declaration but it is very much part of the name of the method as well. Greg ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Localization not working based on region with en-US, en-UK and en lproj
The localization used is determined by matching the AppleLanguages list against the localizations available in the application's main bundle. In this case, the top entry in AppleLanguages is en, so that is the localization that will be used. Douglas Davidson On Feb 3, 2013, at 6:56 AM, Arun wrote: > Yes i am launching the the application between changes to the region. > > Not sure what is Application's preference domain? How can we set/unset this? > > The output of the defaults command as below. > > *$ defaults read com.yourcompany.Hello AppleLanguages* > 2013-02-03 20:22:10.317 defaults[4084:903] > The domain/default pair of (com.yourcompany.Hello, AppleLanguages) does not > exist > > *$ defaults read com.yourcompany.Hello AppleLocale* > 2013-02-03 20:22:13.093 defaults[4085:903] > The domain/default pair of (com.yourcompany.Hello, AppleLocale) does not > exist > * > $ defaults read -g AppleLanguages* > ( >en, >fr, >de, >ja, >es, >it, >pt, >"pt-PT", >nl, >sv, >nb, >da, >fi, >ru, >pl, >"zh-Hans", >"zh-Hant", >ko > ) > > *$ defaults read -g AppleLocale* > en_US > > > On Sun, Feb 3, 2013 at 7:39 PM, Keith Duncan wrote: > >>> My project has >>> 1. en_GB.lproj >>> 2. en_US.lproj >>> 3. en.lproj >>> Directories. Each time even if I change region setting, always strings >> from en.lproj directory is displayed. >> Are you relaunching your application between changes to the region? >> >> Does your application’s preference domain have an overridden >> AppleLanguages or AppleLocale value? >> >> What is the output of these commands: >> >> defaults read -g AppleLanguages >> defaults read -g AppleLocale >> >> defaults read $YOUR_BUNDLE_IDENTIFIER AppleLanguages >> defaults read $YOUR_BUNDLE_IDENTIFIER AppleLocale >> >> replacing the bundle identifier in the second as appropriate >> >> Cheers, >> Keith >> >> ___ >> >> 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: >> https://lists.apple.com/mailman/options/cocoa-dev/arun.ka%40gmail.com >> >> This email sent to arun...@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: > https://lists.apple.com/mailman/options/cocoa-dev/ddavidso%40apple.com > > This email sent to ddavi...@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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Localization not working based on region with en-US, en-UK and en lproj
How can we make the application to use locale based localization? The apple documentation tells that first locale based folders are searched. On Feb 3, 2013 9:45 PM, "Douglas Davidson" wrote: > The localization used is determined by matching the AppleLanguages list > against the localizations available in the application's main bundle. In > this case, the top entry in AppleLanguages is en, so that is the > localization that will be used. > > Douglas Davidson > > On Feb 3, 2013, at 6:56 AM, Arun wrote: > > > Yes i am launching the the application between changes to the region. > > > > Not sure what is Application's preference domain? How can we set/unset > this? > > > > The output of the defaults command as below. > > > > *$ defaults read com.yourcompany.Hello AppleLanguages* > > 2013-02-03 20:22:10.317 defaults[4084:903] > > The domain/default pair of (com.yourcompany.Hello, AppleLanguages) does > not > > exist > > > > *$ defaults read com.yourcompany.Hello AppleLocale* > > 2013-02-03 20:22:13.093 defaults[4085:903] > > The domain/default pair of (com.yourcompany.Hello, AppleLocale) does not > > exist > > * > > $ defaults read -g AppleLanguages* > > ( > >en, > >fr, > >de, > >ja, > >es, > >it, > >pt, > >"pt-PT", > >nl, > >sv, > >nb, > >da, > >fi, > >ru, > >pl, > >"zh-Hans", > >"zh-Hant", > >ko > > ) > > > > *$ defaults read -g AppleLocale* > > en_US > > > > > > On Sun, Feb 3, 2013 at 7:39 PM, Keith Duncan > wrote: > > > >>> My project has > >>> 1. en_GB.lproj > >>> 2. en_US.lproj > >>> 3. en.lproj > >>> Directories. Each time even if I change region setting, always strings > >> from en.lproj directory is displayed. > >> Are you relaunching your application between changes to the region? > >> > >> Does your application’s preference domain have an overridden > >> AppleLanguages or AppleLocale value? > >> > >> What is the output of these commands: > >> > >> defaults read -g AppleLanguages > >> defaults read -g AppleLocale > >> > >> defaults read $YOUR_BUNDLE_IDENTIFIER AppleLanguages > >> defaults read $YOUR_BUNDLE_IDENTIFIER AppleLocale > >> > >> replacing the bundle identifier in the second as appropriate > >> > >> Cheers, > >> Keith > >> > >> ___ > >> > >> 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: > >> https://lists.apple.com/mailman/options/cocoa-dev/arun.ka%40gmail.com > >> > >> This email sent to arun...@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: > > https://lists.apple.com/mailman/options/cocoa-dev/ddavidso%40apple.com > > > > This email sent to ddavi...@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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Localization not working based on region with en-US, en-UK and en lproj
To add British English to your list of preferred languages for succeedingly launched apps to choose from, launch System Preferences, go to the Language & Text panel, choose the Language tab, and drag British English to the top of the list. If British English is not in the list, click the Edit List button and add it. Depending on which OS you're on, some of the UI elements might be slightly different but are generally the same. -- Gary L. Wade (Sent from my iPhone) http://www.garywade.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Binding problem with core data
On Feb 2, 2013, at 6:25 PM, Velocityboy wrote: > Finally got a chance to do some more debugging on this. > > I looked at the referenced object and figured out why the fault, at least. I > had tried to bind the subcategory column's Content to category.subcategories, > which resolved to a relationship on an NSManagedObject. Under the covers, > evidently a relationship is represented as a set, but per the docs, the > Content binding has to be to an array (the docs actually say it should be an > NSArrayController.) > So evidently directly binding Content and Content Values to something hanging > off a managed object, without going through a controller, is not a great idea. > > What I don't see is how to express what I want using an array controller, if > that's what I have to do. I see two choices: > > - Bind the array controller for the popup's elements, somehow, to the > 'subcategories' relationship for the category object that's selected in each > row of the table > - Bind the array controller for the popup's elements to the core data entity > that represents all of the subcategories, and somehow specify to filter that > data per row to just the elements that have a parent of the category that's > selected in the row > > Is it possible to express either of these using just a binding? Or is this > case complex enough that I should be looking at doing this part in code? I re-read your original post and I am not sure what you are actually after. If what you want is, in a table, to display the category and in the same row display a popup of subcategories, you may not be able to accomplish the latter with bindings, but I forget exactly why. You can try binding the column value to controller.arrangedObjects.relationship but I don't know if NSTableView is smart enough to handle it. If it can't (and I suspect that it won't), then you will need to instead handle the popup column manually with NSTableView delegate calls. > On Jan 30, 2013, at 11:23 PM, Quincey Morris wrote: > >> On Jan 30, 2013, at 22:41 , Velocityboy wrote: >> >>> I see two bizarre behaviors: when I change the Category value with the >>> popup button cell in one row, Category values in other rows change. When I >>> change the subcategory, I get an exception: >>> >>> 2013-01-30 22:32:23.192 Testapp[10506:f03] -[_NSFaultingMutableSet >>> objectAtIndex:]: unrecognized selector sent to instance 0x101d5dfd0 >> >> A NSArray selector is being sent to a NSSet object. That suggests you've >> forgotten to set the NSArrayController into "entity" mode, which is >> necessary for a Core Data property, which is modeled as a set rather than an >> array. >> >> In "class" mode, the array controller expects its content to be an array; in >> "entity" mode, it expects the content to be a set. Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Localization not working based on region with en-US
I found that Localisation of Nibs AND Help impossible to get to work together. The Documentation is also very old and misleading. With the App Stores being multilingual, I would hope this would be quick and simple, but it is not. New Zealand/Australia is bad enough, but South Africa is nightmare. I gave up... Everyone in the world gets 1nib and 1help. Sad fail Anyone who has a internet page or other resource that clearly shows how get this working for multiple en_ with BOTH nib and Help, would be doing the rest of the world a great service. cheers Kevin P.S. I did learn en_US and en-US mean different things 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Binding problem with core data
On Feb 3, 2013, at 10:06 AM, Keary Suska wrote: > On Feb 2, 2013, at 6:25 PM, Velocityboy wrote: > >> Finally got a chance to do some more debugging on this. >> >> I looked at the referenced object and figured out why the fault, at least. I >> had tried to bind the subcategory column's Content to >> category.subcategories, which resolved to a relationship on an >> NSManagedObject. Under the covers, evidently a relationship is represented >> as a set, but per the docs, the Content binding has to be to an array (the >> docs actually say it should be an NSArrayController.) > >> So evidently directly binding Content and Content Values to something >> hanging off a managed object, without going through a controller, is not a >> great idea. >> >> What I don't see is how to express what I want using an array controller, if >> that's what I have to do. I see two choices: >> >> - Bind the array controller for the popup's elements, somehow, to the >> 'subcategories' relationship for the category object that's selected in each >> row of the table >> - Bind the array controller for the popup's elements to the core data entity >> that represents all of the subcategories, and somehow specify to filter that >> data per row to just the elements that have a parent of the category that's >> selected in the row >> >> Is it possible to express either of these using just a binding? Or is this >> case complex enough that I should be looking at doing this part in code? > > I re-read your original post and I am not sure what you are actually after. > If what you want is, in a table, to display the category and in the same row > display a popup of subcategories, you may not be able to accomplish the > latter with bindings, but I forget exactly why. You can try binding the > column value to controller.arrangedObjects.relationship but I don't know if > NSTableView is smart enough to handle it. If it can't (and I suspect that it > won't), then you will need to instead handle the popup column manually with > NSTableView delegate calls. Yes, that's exactly what I'm after. Thanks, I'll do it the way you're suggesting. > >> On Jan 30, 2013, at 11:23 PM, Quincey Morris wrote: >> >>> On Jan 30, 2013, at 22:41 , Velocityboy wrote: >>> I see two bizarre behaviors: when I change the Category value with the popup button cell in one row, Category values in other rows change. When I change the subcategory, I get an exception: 2013-01-30 22:32:23.192 Testapp[10506:f03] -[_NSFaultingMutableSet objectAtIndex:]: unrecognized selector sent to instance 0x101d5dfd0 >>> >>> A NSArray selector is being sent to a NSSet object. That suggests you've >>> forgotten to set the NSArrayController into "entity" mode, which is >>> necessary for a Core Data property, which is modeled as a set rather than >>> an array. >>> >>> In "class" mode, the array controller expects its content to be an array; >>> in "entity" mode, it expects the content to be a set. > > > Keary Suska > Esoteritech, Inc. > "Demystifying technology for your home or business" > > ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Interface Builder button appearance
Hi All, I have a nib with a Matrix of one column and 3 rows; in this there are 3 buttons cells of type Switch and Style Check. All are enabled. Recently I noticed that the square of the middle button is slightly darker that the other 2. Using Interface Builder's inspectors, I've tried everything I can think of to see what might be different about this one button that makes it slightly different in appearance from the others. There is another Matrix in the same dialog, also with 3 switch buttons, but all these are identical (except for their titles and tags, of course). I'm fresh out of ideas of what to look for that might be causing this one button to look different from the others; any suggestions regarding what might be causing this behavior would be much appreciated. I'm using Xcode 4.4, BTW. Thanks, Boyd ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: -mouseDragged: invoked when it should not (and without mouseDown)
On 25/01/2013, at 6:30 AM, Tae Won Ha wrote: > Hi, guys. I need some help in event handling. I have a custom view embedded > in a scroll view which is embedded in a split view. The window has got a > toolbar. When I move the window down by dragging the toolbar, very often the > -mouseDragged: of my custom view gets invoked. Curiously enough, it does not > seem to happen when I drag the window up. My questions: > > - Why? > - When I NSLog() things, I see that -mouseDown: of the custom view is not > invoked. What's going on? > > It's the following file > > https://github.com/qvacua/qmind/blob/master/Qmind/QMMindmapView.m > > from line 706. > > I created a dummy project which has got a dummy -mouseDragged: implementation > inside a window with a toolbar. In the dummy project it does not happen at > all. > > I'm clueless. Am I missing something quite simple here? Anybody had similar > problems? Yes, I've seen this happen sometimes - I believe it's a bug. You can mitigate it by examining the event that you get in the mouseDragged: method - if I recall correctly there is something different about the event that allows you to detect that it's the "wrong" one and ignore it, but I can't pinpoint the exact necessaries in my code, sorry. Another option is to forget about using mouseDragged: in your custom view and do everything from mouseDown:, including keeping control and fetching and handling events in a loop and do your dragging there. I'm finding that approach often simplifies things a lot and it means you can only fetch the events you need. --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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Interface Builder button appearance
Can you post a screen shot and/or the nib file? --Andy On Feb 3, 2013, at 3:47 PM, Boyd Collier wrote: > Hi All, > > I have a nib with a Matrix of one column and 3 rows; in this there are 3 > buttons cells of type Switch and Style Check. All are enabled. Recently I > noticed that the square of the middle button is slightly darker that the > other 2. Using Interface Builder's inspectors, I've tried everything I can > think of to see what might be different about this one button that makes it > slightly different in appearance from the others. There is another Matrix in > the same dialog, also with 3 switch buttons, but all these are identical > (except for their titles and tags, of course). I'm fresh out of ideas of > what to look for that might be causing this one button to look different from > the others; any suggestions regarding what might be causing this behavior > would be much appreciated. > > I'm using Xcode 4.4, BTW. > > Thanks, > Boyd ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSOperation communicating progress?
I've added an NSInvocationOperation object to process a large file asynchronously. Everything mostly works fine, but I am trying to add a way for this NSInvocationOperation object to communicate its progress back to the main thread (e.g., setting a percent of the file processed). I have an NSProgressIndicator value bound to a double variable "loadingProgressPercent", and I have the operation updating that value with self.loadingProgressPercent = percent_read * 100.0; Again, everything seems to work fine. The one problem is I get the following warning at the very end: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces. Is there a common approach for an NSOperation object to communicate its progress back to the main thread and have that progress value update an NSProgressIndicator? Thanks, Todd ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSOperation communicating progress?
On Sun, Feb 3, 2013, at 05:09 PM, Todd Heberlein wrote: > I've added an NSInvocationOperation object to process a large file > asynchronously. Everything mostly works fine, but I am trying to add a > way for this NSInvocationOperation object to communicate its progress > back to the main thread (e.g., setting a percent of the file processed). > > I have an NSProgressIndicator value bound to a double variable > "loadingProgressPercent", and I have the operation updating that value > with > > self.loadingProgressPercent = percent_read * 100.0; Do not do this. You'll send KVO on that property from the background thread that's running your operation. > Is there a common approach for an NSOperation object to communicate its > progress back to the main thread and have that progress value update an > NSProgressIndicator? Have your operation post new operations back to +[NSOperationQueue mainQueue] to update the loadingProgressPercent property. --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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: new to Cocoa/Objective-c: many points of confusion
On Jan 21, 2013, at 10:10 PM, Alex Hall wrote: > *delegates: my understanding is that these take the place of subclasses > (though why this is useful is beyond me), overriding methods they are > designed to handle rather than letting the base class take those methods. They don’t take the place of subclassing; both are used in Obj-C and Cocoa frameworks. They’re different design patterns [if you weren’t exposed to the classic Design Patterns book by Gamma et al at school, run out and get a copy.] More specifically, delegation is an alternative to overriding methods. It’s more flexible in that an object can be a delegate of several other objects, even different types of objects. Delegation also fits in well with MVC designs. It’s pretty common in Cocoa for a controller to be the delegate of a view, which lets it handle some of the less GUI-centric policy decisions of the view without getting involved in the visual details. > However, I not only don't see why this is so great, but I don't understand > the syntax used to declare them or attach them to other classes so the > delegates' methods get called when any of those methods are called on the > object to which the delegate is attached. Honestly, there isn’t any particular syntax for delegates. Delegates are not part of the language, they’re just a programming convention. (C# is the only language I know of that has special built-in syntax for delegation.) The delegate pattern basically consists of: * Define an abstract API of messages the class will send its delegate (in Obj-C this would usually be an @protocol) * Declare a ‘delegate’ property of the class, whose type is this protocol * Synthesize the delegate as an instance variable * Have the class’s methods call the delegate as appropriate when something happens. In some cases they might change the instance’s behavior based on the delegate’s return value. Again, I can’t recommend Gamma et al's “Design Patterns” book highly enough. The patterns it describes are the basic building blocks of large-scale software design. > *Every so often I'll see a class between less- and greater-than signs when an > example talks about a delegate, but I don't know what this is for. What does > it mean to put these symbols around a class (or maybe they are around an > object?)? Those are protocols. The Obj-C language documentation describes them in detail. They’re pretty much equivalent to interfaces in Java. > -(IBAction) someObject:(id)inSender; > Huh? Is the (IBAction) casting, or a method call, or what (I understand what > IBAction is, but not why it is where it is and in parentheses)? I know why > the "id" is there, so this action will work with any UI element, but why the > colon? What is inSender doing there, hanging out at the end of the line? U … this is just basic Objective-C syntax for declaring a method. If this doesn’t make sense to you, you really need to go re-read the language guide. The only oddity here is that “IBAction” is really just a #define for “void”. It’s a way to flag a method to Interface Builder as being an action method that target actions can be wired up to. The compiler just sees it as a regular method returning void. As for where the ‘sender’ comes from, the convention is that when a control messages its target, it passes itself as the parameter to the method. That way the object receiving the action can tell what other object invoked the action and can check its properties or whatever. This is passed as a parameter by convention, because there’s no mechanism built into the language to get the object that called a method. —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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iOS 6.0 SDK UIApplicationInvalidInterfaceOrientation
I am getting this error in a universal iOS 6.0 sdk app: 2013-02-03 23:41:57.078 scrappling[20350:c07] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!' This occurs in the iPad 6.0 simulator, simulating a non-retina ipad. The initial view controller of the app is a UITabViewController subclass. The storyboard for the app looks like this: http://dl.dropbox.com/u/597030/debugging/Screen%20Shot%202013-02-03%20at%2011.50.49%20PM.png This is how I reproduce the crash: 1)select an item in the master tableviewcontroller which calls [self presentMoviePlayerViewControllerAnimated:_playerVC]; 2)_playerVC is a MPMoviePlayerViewController subclass that presents a video fullscreen. 3)the moment I tap "Done" on the video, Cocoa Touch fires [MMATabBarController preferredInterfaceOrientationForPresentation] and returns UIInterfaceOrientationMaskLandscape: MMATabBarController.m: ~snip~ -(BOOL)shouldAutorotate { return YES; } -(NSUInteger)supportedInterfaceOrientations { if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { return UIInterfaceOrientationMaskPortrait; } else { return UIInterfaceOrientationMaskLandscape; } } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { // return UIInterfaceOrientationMaskAll; if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { return UIInterfaceOrientationMaskPortrait; } else { return UIInterfaceOrientationMaskLandscape; } } ~snip~ 4)I've confirmed UIInterfaceOrientationMaskLandscape gets returned from -preferredInterfaceOrientationForPresentation 5)I've confirmed UIInterfaceOrientationMaskLandscape gets returned from -supportedInterfaceOrientations 6)Crash! What I don't understand is why this message is occurring because I have confirmed that at startup [MMATabBarController -supportedInterfaceOrientations] returns UIInterfaceOrientationMaskLandscape. Also my info.plist looks like this: UISupportedInterfaceOrientations~ipad UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight Attempted workarounds: 1)I had -preferredInterfaceOrientationForPresentation return UIInterfaceOrientationMaskAll. 2) I added the application:supportedInterfaceOrientationsForWindow: delegate method to the app delegate. I've confirmed that this gets fired and UIInterfaceOrientationMaskLandscape gets returned: -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { return UIInterfaceOrientationMaskPortrait; } else { return UIInterfaceOrientationMaskLandscape; } } 3) I subclassed UINavigationController and I've confirmed that on app startup UIInterfaceOrientationMaskLandscape is returned. The UINavigationController looks like this: MMANavigationController.m: ~snip~ -(BOOL)shouldAutorotate { return YES; } -(NSUInteger)supportedInterfaceOrientations { if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { return UIInterfaceOrientationMaskPortrait; } else { return UIInterfaceOrientationMaskLandscape; } } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { // return UIInterfaceOrientationMaskAll; if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { return UIInterfaceOrientationMaskPortrait; } else { return UIInterfaceOrientationMaskLandscape; } } ~snip~ Any suggestions on what may be going wrong? Michael ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com