Re: Proper setup for embedded framework

2016-08-15 Thread Quincey Morris
On Aug 15, 2016, at 19:28 , Lou Zell  wrote:
> 
> So it looks like when I embed a binary through the general tab, it is only
> of the currently built binary located in derived data!  I have tried
> rebuilding the framework for a device, but then I get the same error on the
> simulator.

The easy thing to check is to look at the build phases for the app, and make 
sure that the framework is listed in the Target Dependencies phase.

If you switch the scheme device in your workspace window from (say) simulator 
to device, then build or run, you should see the app target get re-linked 
(along with re-compilations for changed files). When that happens, does the 
framework target also get re-linked? You can look at the build transcript in 
the Report navigator to be sure. If not, then the dependency mechanism isn’t 
working as you’d expect. If so, the the path to where the embedded framework 
can be found is probably architecture-specific. (Look in the General tab of the 
project info of the app.)

If, when you want to switch the scheme device, you also switch to the framework 
target and rebuild it manually, then switch back to the app target, do you get 
the right framework or the wrong one? That should tell you whether it’s a 
dependency issue or a path (or other referencing) issue.

> I've also tried building the framework for all architectures as a
> workaround but then I get an error at runtime about: "no matching
> architecture in universal wrapper".

This isn’t going to work. There isn’t (there wasn’t, and there isn’t AFAIK) a 
way of building a multi-architecture framework in Xcode that crosses platform 
boundaries, and the simulator platform is macOS even when the target OS is iOS. 
So, this approach would solve the problem between (say) 32- and 64-bit 
architectures on different devices, but not for device vs. simulator.


___

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

Proper setup for embedded framework

2016-08-15 Thread Lou Zell
Hello,

tl;dr; what is the proper way to have a framework project as a dependency
in another project in the same workspace?

I have a framework A that gets embedded in an iOS app B.  My Xcode
workspace has different projects for A and B.  The framework A will be
distributed, but it is also used as the foundation for a sample app (B).
Standard stuff, I think.

So I tap on Project Navigator > Project B > Target > General and hit the
plus sign next to "Embedded binaries".  Sure enough Framework A shows up
and I think all is well.  However, when I run on a device I see this error:

dyld: Library not loaded: @rpath/HarpCommoniOS.framework/HarpCommoniOS
  Referenced from:
/var/containers/Bundle/Application//HarpApp.app/HarpApp
  Reason: no suitable image found.  Did
find: 
/private/var/containers/Bundle/Application//HarpApp.app/Frameworks/HarpCommoniOS.framework/HarpCommoniOS:
mach-o, but wrong architecture

So it looks like when I embed a binary through the general tab, it is only
of the currently built binary located in derived data!  I have tried
rebuilding the framework for a device, but then I get the same error on the
simulator.
I've also tried building the framework for all architectures as a
workaround but then I get an error at runtime about: "no matching
architecture in universal wrapper".  And this feels like a step that
shouldn't be necessary.

My goal: build the app B and have it compile the embedded framework A for
the same architecture!  Is there a doc out there on how to do this? Or does
someone know the secret build setting sauce?

Thanks!
Lou
___

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: Class is implemented in both

2016-08-15 Thread Uli Kusterer
On 15 Aug 2016, at 03:29, Trygve Inda  wrote:
> I have a Pref Pane and a Screen Saver module. They both share a common
> helper class (MyDisplayManager).
> 
> When the pref pane has been loaded and I go into the screen saver (or vis
> versa), because the host app is System preferences, I get:
> 
> Class MyDisplayManager is implemented in both One of the two will be
> used. Which one is undefined.
> 
> The class comes from the same source file. What is the best way to handle
> this? I could ignore it because the classes are the same (same source file)
> so it should not matter which one is used.
> 
> Is there a better way without duplicating and renaming the class?

Source file doesn't matter, it's the executable they're in. The "correct" 
solution would be to have a Framework that both link against. That way, the OS 
knows it's the same thing and loads it only once and links both to it. Of 
course, that only works if it is actually the same framework on disk. 
Otherwise, you may still get the loader seeing them as different (which is the 
only sane thing Apple can do, apart from checksumming both and thereby 
verifying they are actually identical, they really have no way they're the same 
version). So you'd probably need an installer that installs all three into 
predictable locations where they can find each other.

If you can't do that, the only thing you can do is have several different 
copies with different names. a #define in a precompiled header would work. You 
can have a separate header file containing all the shared stuff from any 
precompiled header you might have had before. That way, your PCH could look 
like this:

   #define MYScreenSaverAndPrefPaneHelperClass  
MYPrefPanesScreenSaverAndPrefPaneHelperClass
   #include "MyAppPrefix_Common.pch"

Just keep in mind that this define won't be picked up by any XIBs you're using. 
So if your class gets instantiated by a XIB, you need two versions, or at least 
a shell script build phase that does the same name replacement on the XIB and 
then manually feeds the result through ibtool. If your class only is the file's 
owner of a XIB, then you needn't bother. The file's owner's class is only 
advisory (you get whatever kind of object was passed in as owner when loading 
the XIB).

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.org





___

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

Launch, connect, communicate

2016-08-15 Thread Andrew Keller
Hi all,

In the course of normal work, I put together a really simple plotting 
application.  The problem: I’m at a command-line, and I have some numbers, and 
I want to see them on a simple plot to quickly identify patterns.  My first 
solution: A simple Cocoa app that reads the numbers on stdin, and displays them 
right on the window.  It’s simple, and it works.  At a bash shell, the usage is 
roughly: ` | 
/Applications/Plot.app/Contents/MacOS/Plot &`.  Yes, it’s crude, but it works.

Now, partially for fun and practice, and partially because this architecture is 
stopping me from making some more interesting modifications, I want to separate 
the input of the numbers from the main Plot app.  Ideally, I’d like to see a 
completely separate command-line tool that, when used, performs a series of 
steps:

1. If the main Plot app is _not_ running in the current Aqua session, then 
launch a new copy in the current Aqua session.
2. Open some sort of a socket to the main Plot app in the current Aqua session.
3. Accept numbers on stdin, and forward them through the socket to the main 
Plot app.
4. When stdin is exhausted, exit.

This architecture would, I believe, pave the way for some really neat 
improvements in the future.

So then, here comes the question.  #1 and #2 above strike me as something that 
Launch Services and/or launchd might be capable of, but I’m having trouble 
identifying a set of APIs that would perform this task.  I’ve found lots of 
documentation on having one master app delegate services to a helper that’s 
launched on-demand, but nothing yet on having _two main apps_ — one of them 
command-line and one of them Cocoa — where one can launch and subsequently 
communicate with the other, and then die.

And, for what it’s worth, I am interested in being App Store compliant.  I 
don’t know if this will make it there, but being App Store compliant is also 
something I need to learn, so I figure I may as well shoot for it.

Any ideas?

Or, are there any other mailing lists that may be more closely related to this 
topic?

Thanks,
 - Andrew Keller


___

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: Resizing NSScrollView/NSClipView to fit NSTableView width

2016-08-15 Thread Quincey Morris
On Aug 15, 2016, at 10:22 , studfed studfed  wrote:
> 
> I am not sure if it is the right way to prevent table clipping.
> Are there any other options to accomplish this or this one is correct also
> ?

No, this is not really the right way. You should not be setting frames directly 
in an auto-layout-controlled environment.

The problem is likely that you don’t have suitable sizing options on the table 
columns and/or the table view, and/or you need to initiate table view re-layout 
via ‘setNeedsLayout’.

However, I’d suggest you start by first determining whether the problem is:

a. The contents of the column being clipped by the column.

b. The column being clipped by the table view.

c. The table view being clipped by the scroll view.

All are easily possible, and you’ll only find frustration if you go after the 
wrong problem.

___

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: Class is implemented in both

2016-08-15 Thread Jean-Daniel Dupas

> Le 15 août 2016 à 18:02, Jens Alfke  a écrit :
> 
> 
>> On Aug 15, 2016, at 11:34 AM, Jean-Daniel Dupas > > wrote:
>> 
>> No, You can have only one PCH per project. That said, you can define a 
>> second one that include the first one for your second project.
> 
> I think you meant to say you can have only one PCH per _target_.

Of course. Thanks for the correction. 

___

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

Resizing NSScrollView/NSClipView to fit NSTableView width

2016-08-15 Thread studfed studfed
Hi,

I have added NSTableView to xib (which adds scrollview and clipview by
default), without columns.
Columns are generated programmatically with width based on header cell
size. Autolayout is enabled and constraints are defined in IB like |
-20-|[scrollview]-20-|

It looks like
Window
 MyView
NSScrollView
  ClipView
TableView


The problem is that as soon as columns count grows, table becomes clipped.

The only way to set scrollview/clipview to fit table width, was to set
frameSize of scrollerView's to be equal to tableView frame size like:

[scrollView setFrameSize:[tableView frame].size];

I am not sure if it is the right way to prevent table clipping.
Are there any other options to accomplish this or this one is correct also
?

Thanks
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Class is implemented in both

2016-08-15 Thread Jens Alfke

> On Aug 15, 2016, at 11:34 AM, Jean-Daniel Dupas  wrote:
> 
> No, You can have only one PCH per project. That said, you can define a second 
> one that include the first one for your second project.

I think you meant to say you can have only one PCH per _target_.

—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: Class is implemented in both

2016-08-15 Thread Jean-Daniel Dupas

> Le 15 août 2016 à 15:27, Trygve Inda  a écrit :
> 
>> 
>>> On Aug 15, 2016, at 3:41 AM, Stephane Sudre  wrote:
>>> 
>>> . you could redefine the class name in the .pch of one project.
>> 
>> +1 — I’ve had to do this before, and it works fine. Just add
>> #define MyDisplayManager MyDisplayManager_PP
>> or whatever.
>> 
>> The caveat is that of course IB doesn’t read the PCH, so you’ll have to
>> manually change the class name in any nibs it may appear in.
>> 
>> —Jens
> 
> Both projects share a common pch. Is there a way to add a second pch to just
> one of them?

No, You can have only one PCH per project. That said, you can define a second 
one that include the first one for your second project.



___

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: Bug in 10.12 drawing glyph from labelFont or systemFont with bezier path

2016-08-15 Thread Jerome Krinock
I have a resolution to this subject which I posted here last week.

My reported Apple Bug 27813593 works as expected and is not a bug.  In earlier 
versions of macOS, in the System and Label fonts, the glyphs I was using had 
names, but in 10.12 they do not have names, and that is OK because glyph names 
are not required by the API contract.

The solution is to use CTFontGetGlyphsForCharacters(), of which I was unaware, 
instead of glyph names.

* * *

P.S.  The reason why I’m starting a new thread is because, for the last few 
weeks, for some reason, messages I send to lists.apple.com are not reflected 
back to me.  I’ve asked postmas...@lists.apple.com and my mail provider if 
anything has changed, but no answer yet.
___

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: Class is implemented in both

2016-08-15 Thread Trygve Inda
> 
>> On Aug 15, 2016, at 3:41 AM, Stephane Sudre  wrote:
>> 
>> . you could redefine the class name in the .pch of one project.
> 
> +1 — I’ve had to do this before, and it works fine. Just add
> #define MyDisplayManager MyDisplayManager_PP
> or whatever.
> 
> The caveat is that of course IB doesn’t read the PCH, so you’ll have to
> manually change the class name in any nibs it may appear in.
> 
> —Jens

Both projects share a common pch. Is there a way to add a second pch to just
one of them?




___

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: Class is implemented in both

2016-08-15 Thread Jens Alfke

> On Aug 15, 2016, at 3:41 AM, Stephane Sudre  wrote:
> 
> . you could redefine the class name in the .pch of one project.

+1 — I’ve had to do this before, and it works fine. Just add
#define MyDisplayManager MyDisplayManager_PP
or whatever.

The caveat is that of course IB doesn’t read the PCH, so you’ll have to 
manually change the class name in any nibs it may appear in.

—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: Class is implemented in both

2016-08-15 Thread Stephane Sudre
On Mon, Aug 15, 2016 at 3:29 AM, Trygve Inda  wrote:
> I have a Pref Pane and a Screen Saver module. They both share a common
> helper class (MyDisplayManager).
>
> When the pref pane has been loaded and I go into the screen saver (or vis
> versa), because the host app is System preferences, I get:
>
> Class MyDisplayManager is implemented in both One of the two will be
> used. Which one is undefined.
>
> The class comes from the same source file. What is the best way to handle
> this? I could ignore it because the classes are the same (same source file)
> so it should not matter which one is used.
>
> Is there a better way without duplicating and renaming the class?

IMHO, it depends on how your produce is distributed:

- if you're distributed it via an Installation package and the
components are installed in /Library, you could use a Framework with
the shared class and install it in /Library/Frameworks (and of course
use the framework in both your Pref Pane and Screen Saver module).

- if the installation is supposed to be done manually or with the user
double-clicking the Pref Pane and Screen Saver module to get the OS to
install them either for all users or the current user:

. you could redefine the class name in the .pch of one project.
- you could rename the class after one of the 2 projects has been
built and then codesign the new binary. Basically, you scan the
executable binary for the name of the class and you replace it with a
name of the same length. I'm doing this for screen saver modules who
share some code which is within a submodule.
- you could parse the Mach-O executable file and parse the appropriate
sections (__objc_classname, __objc_classlist, etc.) of the appropriate
segments (__TEXT, __DATA, __OBJC)  (which depends on the Objective-C
version for instance) to find your class name and replace it with a
unique name (again same length unless you're looking into rebuilding
the entire Mach-O).

  e.g. __DATA, __objc_classlist contains 64-bit references to struct
objc2_class_t records in __DATA, __objc_data. The data record of such
a struct will point to a objc2_class_ro_t record in __DATA,
__objc_const and the name record of this struct will point to the name
of the class in __TEXT, __objc_classname.
___

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