UINavigationController subclass won't load its nib.

2013-10-11 Thread Half Activist
Hi,

To put it shortly, my UINavigationController doesn't load its assigned 
NIB at all.

I've got an UINavigationController subclass that contains the code for 
an object inspector in an app i'm writing.
It's declared as the file's owner of a nib of the same name, this nib 
helps me build the ui of the various subviews pushed as details of some 
parameter, selected on a root table view. (ie a somewhat classical way for an 
inspector on ios).
Now, I instantiate my view controller with:

[ [ MyNavController alloc ] initWithNibName: @MyNavController bundle: 
nil ];

And display it in a popover. 

The popover remains empty.
loadView is called but it doesnt not contain the root view assigned in 
IB.
None of my outlets are populated, I overloaded some setters, they 
aren't called at all.
All other objects aren't instantiated by the way...
...Therefore I guess the NIB isn't even loaded!

To rule out a potential resource loading error, I wrote a nib loading 
method of mine using UINib.
And it works, the NIB is correct, everything is correct. Except that 
UINavigationController doesn't want to load its assigned NIB.

Regards.
___

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

Dependency between document types

2013-10-11 Thread Rick Mann
I've switched to using the asynchronous 
-openDocumentWithContentsOfURL:display:completionHandler:, and now I have a 
problem. My app requires that one type of document (which provides a library of 
elements added to the real documents) be open before the untitled document 
gets created. This worked fine before, when the library doc was opened 
synchronously, but now it doesn't.

I could override -makeUntitledDocumentOfType:error: to check for the library 
doc first, set a flag if it's not ready, and have the library doc open 
operation check that flag and create a new document.

But is there a better way?

TIA,
-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: Dependency between document types

2013-10-11 Thread Rick Mann

On Oct 11, 2013, at 02:13 , Rick Mann rm...@latencyzero.com wrote:

 I've switched to using the asynchronous 
 -openDocumentWithContentsOfURL:display:completionHandler:, and now I have a 
 problem. My app requires that one type of document (which provides a library 
 of elements added to the real documents) be open before the untitled 
 document gets created. This worked fine before, when the library doc was 
 opened synchronously, but now it doesn't.
 
 I could override -makeUntitledDocumentOfType:error: to check for the library 
 doc first, set a flag if it's not ready, and have the library doc open 
 operation check that flag and create a new document.
 
 But is there a better way?

I think I may have answered this. It is to return false from 
-applicationShouldOpenUntitledFile:, and then create the new untitled document 
after my library doc has been opened.


-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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

Correct way to change NSPersistentDocument subclass MOC type?

2013-10-11 Thread Rick Mann
I want to change my NSPersistentDocument subclass to use a different 
concurrency type. But I can't find a way to override -managedObjectContext that 
works.

The only discussions online I could find are from 5 years ago.

It does seem to work if I set the MOC in one of the -initXXX methods, but that 
seems brittle.

-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: Correct usage of NSTextView and NSFindBar

2013-10-11 Thread Martin Hewitson
Dear Kevin,

I finally managed to find some moments to get back to this issue. So, taking 
your advice I changed my approach so that now my data model has a single 
textstorage per file/document being managed. When the user selects a file in 
the list then I do

[textView.layoutManager replaceTextStorage:fileDocument.textStorage];

This works just as well as the old approach with regards swapping out the 
contents of the textview, but still the textfinder is behaving badly.

I still get the false search results and I often get errors like the one below 
if I first search one document then switch documents with the find bar open.

Additionally, continuing the search (hitting the enter key) after switching 
documents sometimes works and sometimes doesn’t (in the sense that sometimes 
new search results are highlighted and sometimes not) - I can’t figure out the 
chain of events that leads to this behaviour. It may be that this particular 
bad behaviour only happens once I’ve hit one of the exceptions below.

So clearly I’m still doing something wrong with regards swapping my textstorage 
objects in and out of the textview. 

Any further clues you can offer would be gratefully received,

Martin




0   CoreFoundation  0x7fff8a09d41c 
__exceptionPreprocess + 172
1   libobjc.A.dylib 0x7fff8d24ce75 
objc_exception_throw + 43
2   CoreFoundation  0x7fff8a09d2cc 
+[NSException raise:format:] + 204
3   Foundation  0x7fff8a493675 -[NSString 
rangeOfString:options:range:locale:] + 186
4   Foundation  0x7fff8a4b3554 -[NSString 
rangeOfString:options:range:] + 29
5   AppKit  0x7fff957963c1 
_findStringAux + 196
6   AppKit  0x7fff95796636 
-[_NSTextFinderImpl rangeOfNextMatchInString:currentRange:forward:wrap:] + 286
7   AppKit  0x7fff95793539 
-[_NSTextFinderImpl findForward:completionHandler:] + 1350
8   AppKit  0x7fff954741a2 
-[_NSTextFinderImpl _performAction:] + 253
9   AppKit  0x7fff954d53d0 
-[NSApplication sendAction:to:from:] + 327
10  AppKit  0x7fff954d524e -[NSControl 
sendAction:to:] + 86
11  AppKit  0x7fff9551f7ff 
-[NSTextField textDidEndEditing:] + 843
12  CoreFoundation  0x7fff8a06bfcc 
__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
13  CoreFoundation  0x7fff89f5fc5d 
_CFXNotificationPost + 2893
14  Foundation  0x7fff8a4924aa 
-[NSNotificationCenter postNotificationName:object:userInfo:] + 68
15  AppKit  0x7fff9551d95d 
-[NSTextView(NSPrivate) _giveUpFirstResponder:] + 438
16  AppKit  0x7fff9556ba6c 
-[NSTextView(NSKeyBindingCommands) insertNewline:] + 239
17  AppKit  0x7fff954eedaf 
-[NSResponder doCommandBySelector:] + 71
18  AppKit  0x7fff9551c23a -[NSTextView 
doCommandBySelector:] + 196
19  AppKit  0x7fff954ee2d1 
-[NSKeyBindingManager(NSKeyBindingManager_MultiClients) 
interpretEventAsCommand:forClient:] + 1392
20  AppKit  0x7fff9550d322 
-[NSTextInputContext handleEvent:] + 845
21  AppKit  0x7fff954ecb5d -[NSView 
interpretKeyEvents:] + 180
22  AppKit  0x7fff9550cecd -[NSTextView 
keyDown:] + 658





On 23 Sep 2013, at 06:43 pm, Kevin Perry kpe...@apple.com wrote:

 
 On Sep 20, 2013, at 10:15 PM, Martin Hewitson martin.hewit...@aei.mpg.de 
 wrote:
 
 Actually, I got this wrong. I swap out the textstorage in the textview by 
 calling setTextView on the textContainer which I get from the textStorage 
 that belongs to the file instance being edited. This is probably why I'm 
 bypassing the 'notification' chain. Perhaps I'm going about this 'one editor 
 for many files' problem the wrong way because looking back at (very) old 
 code I get the textContainer by doing
 
 - (NSTextContainer*)textContainer
 {
  // An ugly quick hack to return the 'main' text container for this 
 document
  return [[self.textStorage layoutManagers][0] textContainers][0];
 }
 
 Is there a better way to do all this?
 
 That seems a little backwards to me.
 
 NSLayoutManager is really the center of the Cocoa text architecture. It 
 manages the list of NSTextViews, the list of NSTextContainers (those two 
 objects are associated 1-to-1), and the NSTextStorage that will be rendered 
 and laid out between all of the NSTextViews. It sounds like you're 

Re: Receiving system notifications in 10.8

2013-10-11 Thread Jens Alfke

On Oct 10, 2013, at 9:40 PM, Carl Hoefs newsli...@autonomy.caltech.edu wrote:

 Lots of applications come to mind, if such a mechanism were available. To be 
 able to know when a certain song is playing in iTunes Radio and crank up the 
 volume,

There is (or used to be) an NSDistributedNotification that iTunes posts 
whenever the currently playing track changes. I don’t know if it’s documented 
anywhere, but you can discover what it is by writing a tiny app that adds an 
observer for all distributed notifications of any time and logs them.

 or to send out a text/email/tweet when certain notifications are posted, etc. 
 I would think this would be Generally Useful. Wish there were a way…

It could be useful. But it would be a very different facility, since the data 
posted in the notification would need to be machine-readable not human-readable 
— instead of a localized string you’d want something like an NSDictionary with 
well-defined keys. (The types of notifications sent out would likely be 
different too. For example, there’s no point displaying a visible notification 
when Mail sends a message, but an internal notification would be useful.)

Anyway, this facility already exists — it’s NSDistributedNotification. What 
you’re asking for is basically for more apps to support posting them, which 
isn’t a technical issue so much as one of evangelism.

—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

Re: Correct way to change NSPersistentDocument subclass MOC type?

2013-10-11 Thread Rick Mann

On Oct 11, 2013, at 04:03 , Mikael Hakman mhak...@dkab.net wrote:

 
 On Oct 11, 2013, at 12:37 PM, Rick Mann rm...@latencyzero.com wrote:
 
 In ManagedObjectContext there is method – initWithConcurrencyType:. Perhaps 
 you can use it.

The problem is not the creation of the MOC, it's how to create it in the 
overridden -[NSPersistentDocument managedObjectContext]. If you do, you get an 
error that it can't get at the persistent store coordinator. It doesn't work to 
fist let the superclass create a MOC (by calling super.managedObjectContext) 
and then grabbing that PSC.

It does work, however, to do exactly that in -init.



-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: Correct way to change NSPersistentDocument subclass MOC type?

2013-10-11 Thread Rick Mann
Oh, it seems to work to create the MOC and a coordinator with no stores, and 
leave it at that.

On Oct 11, 2013, at 04:03 , Mikael Hakman mhak...@dkab.net wrote:

 
 On Oct 11, 2013, at 12:37 PM, Rick Mann rm...@latencyzero.com wrote:
 
 In ManagedObjectContext there is method – initWithConcurrencyType:. Perhaps 
 you can use it.
 
 /Mikael
 
 I want to change my NSPersistentDocument subclass to use a different 
 concurrency type. But I can't find a way to override -managedObjectContext 
 that works.
 
 The only discussions online I could find are from 5 years ago.
 
 It does seem to work if I set the MOC in one of the -initXXX methods, but 
 that seems brittle.
 
 -- 
 Rick
 
 
 
 ___
 
 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/mhakman%40dkab.net
 
 This email sent to mhak...@dkab.net
 


-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: UINavigationController subclass won't load its nib.

2013-10-11 Thread David Duncan
I think your approach is wrong. It doesn’t sound like you have a specialized 
navigation controller, but rather a navigation controller that has a 
specialized UI. The way to approach that problem is to load a UIViewController 
subclass with that logic in it, and create a UINavigationController with that 
custom view controller as its root view controller.

If you have further specialized logic that needs to know about both the 
navigation controller and its view controllers, then you can create an 
additional class to manage that work, but you almost certainly don’t want it to 
be a navigation controller subclass.

On Oct 11, 2013, at 2:12 AM, Half Activist halfactiv...@gmail.com wrote:

 Hi,
 
   To put it shortly, my UINavigationController doesn't load its assigned 
 NIB at all.
 
   I've got an UINavigationController subclass that contains the code for 
 an object inspector in an app i'm writing.
   It's declared as the file's owner of a nib of the same name, this nib 
 helps me build the ui of the various subviews pushed as details of some 
 parameter, selected on a root table view. (ie a somewhat classical way for an 
 inspector on ios).
   Now, I instantiate my view controller with:
   
   [ [ MyNavController alloc ] initWithNibName: @MyNavController bundle: 
 nil ];
   
   And display it in a popover. 
   
   The popover remains empty.
   loadView is called but it doesnt not contain the root view assigned in 
 IB.
   None of my outlets are populated, I overloaded some setters, they 
 aren't called at all.
   All other objects aren't instantiated by the way...
   ...Therefore I guess the NIB isn't even loaded!
 
   To rule out a potential resource loading error, I wrote a nib loading 
 method of mine using UINib.
   And it works, the NIB is correct, everything is correct. Except that 
 UINavigationController doesn't want to load its assigned NIB.
   
 Regards.
 ___
 
 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/david.duncan%40apple.com
 
 This email sent to david.dun...@apple.com

--
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: collection of applications

2013-10-11 Thread ChanMaxthon
Seem to me that you are considering making an enterprise single sign-on portal. 
Of course you can combine everything into a single app, but a more graceful 
solution can exist.

Just to correct a misunderstanding, iOS dyld can load dynamic libraries if 
carried as part of the application bundle (and there is a hack that allows 
on-the-fly patching of the in-memory libdyld to load libraries downloaded from 
any arbitrary address, but that involves lots of black magic and Apple can 
reject it if found out.) Also external binaries can be used - there is an App 
Store app called iSSH that carried its own signed version of PuTTY cross 
compiled for iOS.

As mentioned, you can launch other apps by URL schemes. This is also a method 
of inter-app communication as you can encode data into the URL string. You can 
design a family of apps that requires a SSO and a SSO portal. When a client app 
is launched directly it redirects the user to the SSO portal, telling the 
portal who called it. The portal then redirects the user back to the app with 
whatever information needed for the session to continue after authentication. 
It seem to me that Facebook used this scheme in the wild (that is, Facebook app 
is the SSO portal and apps using Facebook SDK is signing on using Facebook app 
itself.)

Sent from my iPad

 On 2013年10月11日, at 12:31, Jens Alfke j...@mooseyard.com wrote:
 
 
 On Oct 10, 2013, at 8:44 PM, Rufat A. Abdullayev rufa...@agbank.az wrote:
 
 I also saw another approach they give a link to app store from application 
 and downloaded other app from App Store separately but managed them from 
 another app like a service ... It’s a pity that I could not get more details 
 on implementation!
 
 Do you mean just launching another app programmatically? You can definitely 
 do that; the typical way involves having the app register a custom URL 
 scheme. But the other apps are just regular apps, not services or anything 
 hidden.
 
 ―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/xcvista%40me.com
 
 This email sent to xcvi...@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

Re: collection of applications

2013-10-11 Thread Jens Alfke

On Oct 11, 2013, at 11:40 AM, ChanMaxthon xcvi...@me.com wrote:

 Just to correct a misunderstanding, iOS dyld can load dynamic libraries if 
 carried as part of the application bundle

Oh? Is this a new thing? In a past project I worked on (in 2011) we had to go 
to a fair bit of trouble to work around this restriction, so I know it used to 
exist.

So does this mean I can package my iOS library as a real dynamic framework the 
way I can on Mac OS?

—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

Re: collection of applications

2013-10-11 Thread Maxthon Chan
This is not new - it existed since iPhone OS 1.0. However by saying “can load 
dynamic libraries” does not mean you can actually use it in production code. 
Apple does not allow any dynamic libraries exist in App Store packages (“Nobody 
but Apple can put dynamic libraries onto iOS device) so the dynamic library 
support is pretty much restricted to jailbreak community. Multiple jailbreaks 
and jailbreak packages used this ability.

On Oct 12, 2013, at 7:18, Jens Alfke j...@mooseyard.com wrote:

 
 On Oct 11, 2013, at 11:40 AM, ChanMaxthon xcvi...@me.com wrote:
 
 Just to correct a misunderstanding, iOS dyld can load dynamic libraries if 
 carried as part of the application bundle
 
 Oh? Is this a new thing? In a past project I worked on (in 2011) we had to go 
 to a fair bit of trouble to work around this restriction, so I know it used 
 to exist.
 
 So does this mean I can package my iOS library as a real dynamic framework 
 the way I can on Mac OS?
 
 —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

Re: collection of applications

2013-10-11 Thread Jens Alfke

On Oct 11, 2013, at 7:57 PM, Maxthon Chan xcvi...@me.com wrote:

 This is not new - it existed since iPhone OS 1.0. However by saying “can load 
 dynamic libraries” does not mean you can actually use it in production code. 
 Apple does not allow any dynamic libraries exist in App Store packages 
 (“Nobody but Apple can put dynamic libraries onto iOS device) so the dynamic 
 library support is pretty much restricted to jailbreak community.

Oh. I wouldn’t count this as something that iOS can do, then, not in any 
realistic sense.
And discussion of jailbroken features is not allowed on this list anyway.

—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