Re: Xcode interferes with signal handler

2024-01-30 Thread Pascal Bourguignon via Cocoa-dev

Le 30/01/2024 à 20:31, Gabriel Zachmann via Cocoa-dev a écrit :

I am setting up a signal handler in my app like this:

void *e = signal( SIGUSR1, signal_handler );
if ( e == SIG_ERR )
   ...

It works (i can 'kill -30 '), BUT ONLY, if I run my app outside of Xcode.

When I launch it from Xcode, and I send a SIGUSR1 to my app, it always breaks 
at mach_msg2_trap.
Obviously, this is a bit tedious for developing, since now I always have to go 
through Product / Archive / Distribute ...

Any ideas, how I can prevent this from happening?

And it's unclear to me what's going on. Can Xcode really prevent signal(3) from 
installing a signal handler?
Or does a kill on the command line deliver the signal to several processes, one 
of them, maybe, an ancillary process from Xcode?



There must be a command to forward the signals.

With gdb, you did:

handle SIGUSR1 nostop pass

If Xcode still uses lldb, then it should be something like:

process handle SIGUSR1 --stop false --pass true

or with the GUI, assuming some version:

In Xcode, you can configure the signal handling behavior using the 
"Scheme" settings. Here's how you can do it:


1. Open your project in Xcode.
2. Select the target you want to configure the signal handling for.
3. Go to "Product" in the menu bar, then select "Scheme" and click on 
"Edit Scheme..."

4. In the left sidebar of the "Run" section, select "Diagnostics".
5. Under the "Signal Handling" section, you can add or remove signals 
based on your requirements.
6. To add a signal, click the "+" button and enter the name of the 
signal (e.g., "SIGTERM").
7. By default, the signal will be set to stop the program. To make the 
program handle the signal, uncheck the "Stop" checkbox next to the signal.

8. Click "Close" to save the changes.


From memory, I've not used it recently.
--
__Pascal Bourguignon__

___

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: "Z" in setDateFormat ?

2023-07-22 Thread Pascal Bourguignon via Cocoa-dev

Le 22/07/2023 à 12:15, Gabriel Zachmann via Cocoa-dev a écrit :

In the Apple docs in chapter "Date Formatters" I found sample code that 
contains this line:

   [rfc3339DateFormatter setDateFormat:@"'-'MM'-'dd'T'HH':'mm':'ss'Z'"];

Now, my very specific question is: what does the 'Z' do?
And where would I find the doc about it? (and potential other letters?)
My guess would be it has something to do with the 'Z'/time offset mentioned in 
RFC 3339, but it is unclear to me exactly what is meant here.


This comes from the ISO-8601 standard for date formats.  Z is a timezone 
indication: zulu = UTC.


https://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators

--
__Pascal Bourguignon__

___

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: Future of Cocoa

2019-11-21 Thread Pascal Bourguignon via Cocoa-dev


> On 21 Nov 2019, at 23:22, Dragan Milić via Cocoa-dev 
>  wrote:
> 
> And then that famous “I leave” announcement, like children not being happy 
> with how others play with them, so grabbing their toys and leave… But not 
> before making a verbal announcement about it… Well yes, good bye! What else 
> is to say? No personal or list attacks whatsoever.

It’s not like children not being happy.

The Apple ecosystem implies an extraordinary maintenance load. 
Specifically, your application must provide enough revenue to pay for a couple 
of developpers only to track the changes Apple makes to the API, and update it 
on each new version of the system (which occur about yearly).
So, count about 100,000 €/year to 200,000 €/year.
If your application doesn’t provide this profit, then you cannot follow, and 
it will quickly be dropped from the the AppStore.

Are only applications providing good revenue worth developing and worth having?
Why couldn’t we have application developed once for a few users, and working 
consistently over long periods, on a stable platform? 
Currently the only solution would be to package such application in frozen 
hardware and system software, which is not practical (users would need 
different computers for each application!), and feasible (computers are not 
really buillt to last more than a few year of usage).

Actually, things have changed. On Macintosh, basically an application developed 
in 1984 against the Inside Macintosh (1.0) specifications still worked in 1999 
in the blue box with MacOS 9.1.  The platform was more stable.


So what can we do?

Well unfortunately when we are in this situation, we must consider very 
carefully the investment on Apple platforms when developing an application.
A lot of application shouldn’t have been developed on macOS or on iOS, but on 
Linux or Android instead.  
You might have a harder time explaining it to the users, but such are the 
economic realities Apples puts us in.


-- 
__Pascal J. Bourguignon__




___

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: Implementing an import command in NSDocument-based app

2018-05-16 Thread Pascal Bourguignon


> Le 16 mai 2018 à 09:26, Rick Mann  a écrit :
> 
> I'm working on a little NSDocument-based app. The documents are packages (a 
> directory containing multiple files). One of the operations is to import a 
> music file into the document, which should copy the music file into the 
> package, and set it as the track for the document.
> 
> Undoing this operation is somewhat complex (where do I store the previous 
> track if any?). So for now, I want to ignore undo.
> 
> But I'm not sure how to copy the track file into the package. For example, 
> what if it's an untitled document, and therefore has no package on disk? The 
> action should result in a dirty document that isn't committed to disk until 
> the next save (be it automatic or manual).
> 
> Can this even be done without undo?
> 
> Along those lines, how do I mark a document as dirty after some change, 
> without making the change undoable?

You have a choice, for « unsaved » documents:
- either you keep them only in memory, or
- you record them in a « untitled » file package, perhaps in /tmp.

An element of choice is how you want to process the import:
- either you copy the data immediately,
- or you copy the data only when the document is saved.

In the later case, you and the user will have a problem if the imported file is 
deleted before the unsaved document is saved.

If you copy the data immediately, when the unsaved document is only kept in 
memory, then it may be difficult to load big files in memory, notably if bigger 
than the actual RAM available: the system will start to swap the memory to the 
swap file, and this will be very slow, and may even crash if there’s not enough 
free space on the disk where the swap files are stored.  But one good news is 
that nowadays everybody has 64-bit systems, so it should be possible to load in 
memory even files bigger than 4GB.

I guess you see where I’m drifting to: it’s best to keep your document saved on 
disk all the time, even before it’s saved explicitely by the user.  The bonus 
feature, is that if your application crashes, or the system is powered off, you 
can restore the unsaved document (if you don’t put it in /tmp, but eg. in 
~/Documents/Unsaved\ Documents/).  Then you can copy the imported data to a 
file as soon as the import function is activated, so even if the imported file 
is deleted, the imported data will be there.  And then you don’t have to 
implement in-memory data structure for unsaved documents, since by definition 
all documents are backed by files the same way (only a different path), whether 
they’re « saved » nor not « saved ».  Much simplier.  When you launch the 
application, scan the unsaved documents folder for unsaved document,  and 
re-open them, to let the user choose whether to close (and delete them), or to 
save them.

-- 
__Pascal J. Bourguignon__




___

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: [OT] Question about writing documentation

2017-04-22 Thread Pascal Bourguignon

> On 22 Apr 2017, at 18:31, Uli Kusterer  wrote:
> 
> On 21. Apr 2017, at 19:28, davel...@mac.com wrote:
>> You did't say what you tried, but IMO the best app for professional looking 
>> figures on the Mac is OmniGraffle from omnigroup.com. There are extensive 
>> stencil libraries for many things and I expect one could work (at least as a 
>> starting point) for you or you could create a stencil group you could reuse. 
>> They have a free trial.
>> 
>> I'm not affiliated with OmniGroup - just a satisfied customer.
> 
> Also, I'm not sure if OmniGraffle still has this feature, but in ye olde days 
> you could drag an Xcode project on OmniGraffle and it would actually generate 
> a diagram from the source files. That might have been back in the Project 
> Builder days though, so might have been discontinued with one of the two 
> dozen ObjC syntax and Xcode file format changes.


The feature still exists in OmniGraffle 7.


-- 
__Pascal J. Bourguignon__



___

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: Binary floating point format

2017-03-30 Thread Pascal Bourguignon

> On 31 Mar 2017, at 02:25, Carl Hoefs  wrote:
> 
> I have megabytes of raw legacy science datasets that I'm trying to read into 
> my app and ingest into an array of doubles. The data is supposed to be 
> organized as a stream of 8-byte doubles. I do not know how these datasets 
> were generated, so I don't know what format (big/little endian, byte swapped, 
> etc) they are in. 
> 
> If I read the data directly into double variables, they evaluate as very 
> small (E-92, etc).
> 
> I've tried all of these functions:
> 
>  NSSwapDouble()
>  NSSwapBigDoubleToHost()
>  NSSwapLittleDoubleToHost()
>  NSConvertSwappedDoubleToHost()
>  CFConvertDoubleSwappedToHost()
> 
> The above functions generally return invalidly large values (E+87, etc).
> 
> Here is a hex dump of 4 binary doubles:
> 
> 49BF7DE372533C05 A8C02FE3135B4F09 86C22FE37E630B05 27C2C4E3E258BA08
> 
> It seems there's some structure to them, as the last byte is always in the 
> range of 03 to A0, so maybe they somehow correspond to IEEE 754 
> double-precision binary floating point format? 
> 
> Is there yet another function I could use to parse this binary data?

Do these values look more sensible?

Perhaps it’s IBM floating points?

cl-user> (let ((ds  '(#x1122334455667788 #x49BF7DE372533C05 
  #xA8C02FE3135B4F09 #x86C22FE37E630B05 
#x27C2C4E3E258BA08)))
   (dolist (swap '(identity swap64/8 swap64/32 swap-32-32))
 (dolist (n ds (terpri))
  (format t "~8,'0X ~~> ~8,'0X -> ~A~%" n (funcall swap n)
 (ibm-to-double-float (funcall swap n))

1122334455667788 ~> 1122334455667788 -> 2.3754432874621412D-67
49BF7DE372533C05 ~> 49BF7DE372533C05 -> 5.202153205871582D0
A8C02FE3135B4F09 ~> A8C02FE3135B4F09 -> -1.0481728277757355D-39
86C22FE37E630B05 ~> 86C22FE37E630B05 -> -1.3051642321919604D-80
27C2C4E3E258BA08 ~> 27C2C4E3E258BA08 -> 6.365827421850181D-41

1122334455667788 ~> 8877665544332211 -> -1.7249758893089965D-78
49BF7DE372533C05 ~> 53C5372E37DBF49 -> 1.0356655888799012D-81
A8C02FE3135B4F09 ~> 94F5B13E32FC0A8 -> 2.5774949195090032D-77
86C22FE37E630B05 ~> 50B637EE32FC286 -> 3.933545844594491D-82
27C2C4E3E258BA08 ~> 8BA58E2E3C4C227 -> 6.637651455481117D-78

1122334455667788 ~> 5566778811223344 -> 6.01657272434688D+14
49BF7DE372533C05 ~> 72533C0549BF7DE3 -> 2.798654988457155D+50
A8C02FE3135B4F09 ~> 135B4F09A8C02FE3 -> 1.1405782651894492D-64
86C22FE37E630B05 ~> 7E630B0586C22FE3 -> 7.98839220202526D+64
27C2C4E3E258BA08 ~> E258BA0827C2C4E3 -> -1.5431197015853318D+31

1122334455667788 ~> 4433221188776655 -> 7.11677876097383D-6
49BF7DE372533C05 ~> E37DBF49053C5372 -> -7.647223718743149D+31
A8C02FE3135B4F09 ~> E32FC0A8094F5B13 -> -1.0059537510577916D+32
86C22FE37E630B05 ~> E32FC286050B637E -> -1.4436818052519877D+31
27C2C4E3E258BA08 ~> E3C4C22708BA58E2 -> -2.3622313801204285D+32


Or perhaps it’s Microsoft floating points?

cl-user> (let ((ds  '(#x1122334455667788 #x49BF7DE372533C05 
  #xA8C02FE3135B4F09 #x86C22FE37E630B05 
#x27C2C4E3E258BA08)))
   (dolist (swap '(identity swap64/8 swap64/32 swap-32-32))
 (dolist (n ds (terpri))
  (format t "~8,'0X ~~> ~8,'0X -> ~A~%" n (funcall swap n) 
(ibm-to-double-float (funcall swap n))

1122334455667788 ~> 1122334455667788 -> 1.2202591425418212D-34
49BF7DE372533C05 ~> 49BF7DE372533C05 -> -1.0380788666241747D-17
A8C02FE3135B4F09 ~> A8C02FE3135B4F09 -> -4.1271856580565436D+11
86C22FE37E630B05 ~> 86C22FE37E630B05 -> -24.273383128545337D0
27C2C4E3E258BA08 ~> 27C2C4E3E258BA08 -> -6.145829211972407D-28

1122334455667788 ~> 8877665544332211 -> 123.69986928104575D0
49BF7DE372533C05 ~> 53C5372E37DBF49 -> 3.4590018121487237D-38
A8C02FE3135B4F09 ~> 94F5B13E32FC0A8 -> 6.093638471033148D-37
86C22FE37E630B05 ~> 50B637EE32FC286 -> 2.5601652562851923D-38
27C2C4E3E258BA08 ~> 8BA58E2E3C4C227 -> -2.7381261883853355D-37

1122334455667788 ~> 5566778811223344 -> 5.117393619226236D-14
49BF7DE372533C05 ~> 72533C0549BF7DE3 -> 2.5181109391411485D-5
A8C02FE3135B4F09 ~> 135B4F09A8C02FE3 -> 6.5995823691006745D-34
86C22FE37E630B05 ~> 7E630B0586C22FE3 -> 0.11086086575985371D0
27C2C4E3E258BA08 ~> E258BA0827C2C4E3 -> 1.3414732167249665D+29

1122334455667788 ~> 4433221188776655 -> 3.034632414629399D-19
49BF7DE372533C05 ~> E37DBF49053C5372 -> 3.1412382858272243D+29
A8C02FE3135B4F09 ~> E32FC0A8094F5B13 -> 2.175711360216376D+29
86C22FE37E630B05 ~> E32FC286050B637E -> 2.1758016487161476D+29
27C2C4E3E258BA08 ~> E3C4C22708BA58E2 -> -2.4357511146913354D+29


You have to choose the byte swapping. 

https://en.wikipedia.org/wiki/IBM_Floating_Point_Architecture#Double-precision_64-bit
 

If that’s the case, then the first (big-endian) byte order is probably the 
right one, 
but the example data you gave may be wrong.  Instead of dumping the file 8 
octets by 8 octets, you should dump it 

Re: More elegance than a long if/else

2017-03-11 Thread Pascal Bourguignon

> On 11 Mar 2017, at 09:57, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Mar 10, 2017, at 17:35 , Pascal Bourguignon <p...@informatimago.com 
> <mailto:p...@informatimago.com>> wrote:
>> 
>> this is much clearer in intent than return x+y.  So much clearer…
> 
> My argument is not that the original solution was clearer because longer, but 
> that it was longer because clearer.
> 


My argument is that algebraic expressions are clearer than switches.


-- 
__Pascal J. Bourguignon__



___

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: More elegance than a long if/else

2017-03-10 Thread Pascal Bourguignon

> On 10 Mar 2017, at 23:32, Quincey Morris 
>  wrote:
> 
> On Mar 10, 2017, at 08:24 , Bryan Vines  wrote:
>> 
>> Would integer division work better than the modulus operator?
> 
> It would certainly work better in the sense that division is the right 
> operator and modulus is the wrong one!
> 
> Regarding the original question, I would add that there’s a decent argument 
> to be made that keeping a long series of cases is clearer in intent and 
> methodology than a concise but somewhat obscure calculation.


Of course.  

switch(x){
case 0: return y;
case 1: y++; return y;
case 2: y++; y++; return y;
case 3: y++; y++; y++ ; return y;
…
}

this is much clearer in intent than return x+y.  So much clearer…



-- 
__Pascal J. Bourguignon__



___

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: Migrating shared library plugins to Cocoa Touch Frameworks

2016-12-04 Thread Pascal Bourguignon

> On 3 Dec 2016, at 12:00, Andreas Falkenhahn  wrote:
> 
> On 03.12.2016 at 00:40 Jens Alfke wrote:
> 
>> dlopen is hardly undocumented; it’s part of the core BSD Unix
>> library. It’s got a man page and everything.
> 
> That doesn't mean that it's ok to use it on iOS because of the sandbox.
> You aren't allowed to use other standard BSD functions like exit(),
> mkstemp(), exec(), system(), etc. on iOS either because of the sandbox.
> 
>> Prior to iOS 8, the sandbox that 3rd party iOS apps ran in blocked
>> calls to dlopen, as well as other attempts to load dynamic libraries
>> from within the app bundle. That is now no longer the case, so you
>> can use dlopen
> 
> Once again, that is your opinion unless there is any document from
> Apple explicitly stating that it's allowed. The fact that it works
> doesn't count :)
> 
> I don't want to sound overly pedantic here and I really believe you
> guys that probably it's really allowed to use dlopen() starting with
> iOS 8 and everything is fine. All I'm trying to stress here is that
> basically when using dlopen() we are relying on undocumented behaviour
> and there is no guarantee that what we're doing is really officially
> supported.
> 
>> That’s sort of weird; however, a framework is just a dynamic
>> library packaged with its headers in a specific bundle format. You
>> can always use a framework target and then add a script build step
>> to copy the library out of the framework.
> 
> Once again, that's relying on undocumented behaviour. It's obvious
> that a framework is just a bundle containing a dylib but nobody
> can say whether manually dlopen()ing this dylib is something that is
> allowed on iOS. Maybe future versions of iOS will block manual dlopen()
> access to the dylib inside the framework and will only allow the
> system dylib loader to open it. Who knows.

Your worries are formally justified: we are all at the mercy of Apple.

A lot of features are underspecified, or come with an implicit promise 
from Apple, not an explicit one.  For example, in the written 
documentation you get no guarantee of being able to create a secret key
inside the secure enclave.  It is formally written down only as a 
possibility that Apple reserves to itself to create a secret key inside
the secure enclave in some very restrictive cases (some specific key 
type).  Of course, if no secure enclave is available, the specified API
can still create secret keys for you.  But if your purpose is to ensure
that your secret key is inside the secure enclave, you have no guaranty
from Apple! 


> 
>> I think the lack of a dylib target may just reflect that plug-ins
>> of the kind you’re implementing aren’t really very useful on iOS.
>> Since there’s no way to install extra plugins (downloading
>> executable code is explicitly forbidden), the set of plugins is
>> effectively fixed, meaning it would be more efficient to just
>> statically link them all into the app.
> 
> What about NSDocumentDirectory? Users could copy additional plugins
> as frameworks into the app's documents directory using iTunes. Will
> dlopen()ing such dylibs work as well? Or does it only work when the
> binaries are stored in the main bundle container?

Notably, the App Store Review Guidelines doesn’t specify a formal criteria.
https://developer.apple.com/app-store/review/guidelines/ 


However, it seems that your scenario is clearly rejected. (2.1, 2.5.2, 2.5.3).

There is no exception, even thru the AppStore 
(On Demand Resources explicitly exclude executable code).
https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/On_Demand_Resources_Guide/


-- 
__Pascal J. Bourguignon__



___

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: Migrating shared library plugins to Cocoa Touch Frameworks

2016-12-02 Thread Pascal Bourguignon

> On 3 Dec 2016, at 00:40, Jens Alfke  wrote:
> 
> 
>> On Dec 2, 2016, at 2:17 PM, Andreas Falkenhahn > > wrote:
>> 
>> Well, just because apps that use undocumented features aren't rejected from 
>> the
>> app store doesn't make it official for me.
> 
> dlopen is hardly undocumented; it’s part of the core BSD Unix library. It’s 
> got a man page and everything.
> 
> Prior to iOS 8, the sandbox that 3rd party iOS apps ran in blocked calls to 
> dlopen, as well as other attempts to load dynamic libraries from within the 
> app bundle. That is now no longer the case, so you can use dlopen, dynamic 
> frameworks, etc.
> 
>> Also, there is no "Library" template for iOS in Xcode. Only a Cocoa Touch
>> Framework template. This also doesn't look like dlopen() is officially
>> supported on iOS.
> 
> That’s sort of weird; however, a framework is just a dynamic library packaged 
> with its headers in a specific bundle format. You can always use a framework 
> target and then add a script build step to copy the library out of the 
> framework.
> 
> I think the lack of a dylib target may just reflect that plug-ins of the kind 
> you’re implementing aren’t really very useful on iOS. Since there’s no way to 
> install extra plugins (downloading executable code is explicitly forbidden), 
> the set of plugins is effectively fixed, meaning it would be more efficient 
> to just statically link them all into the app.

The reason is rather you need to provide a code signature along with the dylib, 
hence the use of a framework bundle instead of a standalone .dylib.

-- 
__Pascal J. Bourguignon__



___

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: Migrating shared library plugins to Cocoa Touch Frameworks

2016-12-02 Thread Pascal Bourguignon

> On 2 Dec 2016, at 23:17, Andreas Falkenhahn <andr...@falkenhahn.com> wrote:
> 
> On 02.12.2016 at 22:55 Pascal Bourguignon wrote:
> 
>> You would just embed the framework, without linking it.
> 
> I'm not very familiar with the latest Xcode so does this mean I should add
> my framework to "Embedded binaries" but not to "Linked Frameworks and 
> Libraries”?

Yes.


-- 
__Pascal J. Bourguignon__



___

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: Migrating shared library plugins to Cocoa Touch Frameworks

2016-12-02 Thread Pascal Bourguignon

> On 2 Dec 2016, at 15:37, Andreas Falkenhahn <andr...@falkenhahn.com> wrote:
> 
> On 02.12.2016 at 07:57 Pascal Bourguignon wrote:
> 
>> Yes, dlopen is supported in iOS 8 and following.
> 
> Is this support official or does it just work by chance and might stop 
> working in the
> future? I've tried to find an official word from Apple concerning dlopen() on 
> iOS
> but I haven't been successful so far. Is there one? 

Yes, it’s “official”.
I’ve read the document about what is allowed and rejected for the AppStore, and 
this is not rejected.


> 
>> But of course, you can only open and link with libraries that have been code 
>> signed properly.
>> We use dlopen to load at run-time frameworks properly code signed
>> and included in the application bundle
> 
> So how does that work in practice? Should I create a Cocoa Touch Framework, 
> code sign
> it, include it in the "Embedded binaries" section in Xcode in my project and 
> select
> "Optional" for that framework in the "Linked frameworks and Libraries" 
> section in
> Xcode and then just use dlopen() on the framework's executable as listed in 
> the
> frameworks Info.plist? 

http://framemywork.blogspot.fr/2015/01/ios-8-app-extensions-dlopen-loading.html 
<http://framemywork.blogspot.fr/2015/01/ios-8-app-extensions-dlopen-loading.html>

You would just embed the framework, without linking it.


> I can imagine that this works but once again the question is whether or not
> Apple officially supports directly dlopen()ing a framework executable? If they
> do, that would be great but if this is something that just happens to work 
> right
> now but might not do so in future versions I'd rather do it in a more 
> conventional
> way.


dlopen wasn’t available before iOS 7. It wasn’t officially supported in iOS 7, 
only from iOS 8 (when Xcode started to provide a iOS framework  template).

There are applications published in the AppStore that use dlopen.


Now, the framework must be code signed and packaged with your application, so 
this doesn’t concern third-party plug-ins, or anything you’d download from the 
internet.

On the other hand, in iOS 9 they started to allow modular downloading of 
applications in the AppStore: you can install eg. a game with the first levels, 
and only download and install further levels modularly once the previous ones 
are completed; 

http://ddeville.me/2014/04/dynamic-linking 
<http://ddeville.me/2014/04/dynamic-linking>


-- 
__Pascal J. Bourguignon__



___

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: Migrating shared library plugins to Cocoa Touch Frameworks

2016-12-01 Thread Pascal Bourguignon

> On 2 Dec 2016, at 01:31, Jens Alfke  wrote:
> 
> 
>> On Dec 1, 2016, at 7:58 AM, Andreas Falkenhahn  
>> wrote:
>> 
>> My app supports external plugins. On macOS, Linux, and Windows those plugins
>> are just shared objects/dylibs (or DLLs) loaded via dlopen() (or 
>> LoadLibrary()
>> on Windows) at runtime.
> 
> Does iOS still not support dlopen? I thought that, when iOS 8 granted the 
> ability to load dynamic libraries, that dlopen would start working.

Yes, dlopen is supported in iOS 8 and following.
But of course, you can only open and link with libraries that have been code 
signed properly.  
We use dlopen to load at run-time frameworks properly code signed and included 
in the application bundle

> What about the CFBundle API? Is that supported?
> 
>> Now I'm looking for a way to port this design to iOS. The obvious choice 
>> seems
>> to be turning the individual plugins into individual Cocoa Touch Frameworks.
>> However, this results in the following big problem: The symbol names are the
>> same for every plugin, i.e. every plugin has a symbol named InitPlugin(), a
>> symbol named FreePlugin(), and so on.
> 
> If you use frameworks then yes, you’ll have to rename the exported symbols in 
> every plugin to be unique.

You don’t need to rename external symbols when you load a library dynamically.  
In that case, each library has its own symbol table, and you can search for 
symbols of same name in different libraries, using the dlsym function.

— 
__Pascal Bourguignon__


___

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: Documentation Workflow

2016-11-12 Thread Pascal Bourguignon

> On 12 Nov 2016, at 18:41, Richard Charles  wrote:
> 
> The current documentation seems to be well formatted for display on an iPad. 
> Does anyone have a programming work flow that uses the documentation 
> displayed on an iPad or iOS device?
> 
> I suppose if you are commuting to work riding a train or a bus and want to 
> review the documentation on your iPad this might work well. This might also 
> work if the documentation was sitting at your side on an iPad like a book or 
> if you wanted to read the documentation like you would read a bound book. 
> However I would be surprised if many programmers have a programming work flow 
> like this. It is simply too restrictive, slow, and cumbersome when actually 
> coding.
> 
> My current workflow has a local copy of OS X 10.9 documentation displayed in 
> Safari, often using multiple tabs, on a second display. I find this 
> documentation setup to be very helpful, searchable, inclusive, and productive.
> 
> Why is the documentation team going down this bizarre path? Do they really 
> think we will be programming on iPads some day?

Indeed, the main problem with the documentation on iPad, is that it’s harder to 
copy-and-paste from it to Xcode source windows. 
But I hear that in macOS Sierra and iOS 10, it’s possible to copy-and-paste 
from an iPad to the Mac?


-- 
__Pascal J. Bourguignon__



___

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: iOS Application influencing a running web app?

2016-09-23 Thread Pascal Bourguignon
A web application has a bunch of urls, each connected to a different function. 
Define an url to set a parameter and connect it to the function that sets this 
parameter. Use this url only in the iOS application. You may want to use some 
authentication protocol to authorize the parameter setting, but this should be 
already provided by your web application framework. 

-- 
__Pascal Bourguignon__

> Le 23 sept. 2016 à 16:46, Eric E. Dolecki <edole...@gmail.com> a écrit :
> 
> Thanks for your reply. I'm not sure I'm following, though. Do you mean to 
> send it query strings? I could make the HTML page of the app a PHP page. If 
> that's what you meant.
> 
> Eric
> 
>> On Fri, Sep 23, 2016 at 10:42 AM Pascal Bourguignon <p...@informatimago.com> 
>> wrote:
>> Just write some http app on the laptop, and hit it with requests (urls) from 
>> the iOS app; this would be the Q way to do it easily and with some level 
>> of security (https).
>> 
>> Since you already have a web app, you can just add some admin requests to it.
>> --
>> __Pascal Bourguignon__
>> 
>> > Le 23 sept. 2016 à 16:27, Eric E. Dolecki <edole...@gmail.com> a écrit :
>> >
>> > I am going to have a web application running on a local laptop - which runs
>> > various a prototype of a user experience.
>> >
>> > I've been asked to add an iOS application to the mix, to control parameters
>> > in the running app on the laptop.
>> >
>> > What might be the best way to architect this type of set up (and also
>> > easiest)? Have the web app poll a file for contents - and have the iOS app
>> > talk to a PHP page with POSTs of values and write to that file - and have
>> > my app poll it? Sounds terrible. Some AJAX thing? I'd like to avoid a
>> > database if possible.
>> >
>> > Just throwing this out there. If it's too off-topic, please disregard this.
>> >
>> > Thanks,
>> > Eric
>> > ___
>> >
>> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> >
>> > Please do not post admin requests or moderator comments to the list.
>> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> >
>> > Help/Unsubscribe/Update your Subscription:
>> > https://lists.apple.com/mailman/options/cocoa-dev/pjb%40informatimago.com
>> >
>> > This email sent to p...@informatimago.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: iOS Application influencing a running web app?

2016-09-23 Thread Pascal Bourguignon
Just write some http app on the laptop, and hit it with requests (urls) from 
the iOS app; this would be the Q way to do it easily and with some level of 
security (https). 

Since you already have a web app, you can just add some admin requests to it. 
-- 
__Pascal Bourguignon__

> Le 23 sept. 2016 à 16:27, Eric E. Dolecki  a écrit :
> 
> I am going to have a web application running on a local laptop - which runs
> various a prototype of a user experience.
> 
> I've been asked to add an iOS application to the mix, to control parameters
> in the running app on the laptop.
> 
> What might be the best way to architect this type of set up (and also
> easiest)? Have the web app poll a file for contents - and have the iOS app
> talk to a PHP page with POSTs of values and write to that file - and have
> my app poll it? Sounds terrible. Some AJAX thing? I'd like to avoid a
> database if possible.
> 
> Just throwing this out there. If it's too off-topic, please disregard this.
> 
> Thanks,
> Eric
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/pjb%40informatimago.com
> 
> This email sent to p...@informatimago.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: Why doesn't this crash?

2016-09-10 Thread Pascal Bourguignon
It returns nil by feature of Objective-C. 
Referencing the class will translate into a runtime class lookup which will 
return nil. Sending a message to nil  will return nil.

The only caveat is that a class with that name could be provided by a library 
and invalidate your code. But I would say improbable, and I would count on it. 
Just be careful to never dereference those nils!

-- 
__Pascal Bourguignon__

> Le 10 sept. 2016 à 13:39, Andreas Falkenhahn  a écrit 
> :
> 
> I want my app to run on 10.6 but use 10.7 features where available. Thus I'm
> compiling on 10.11 using -mmacosx-version-min=10.6. In particular, I want to
> use AVFoundation to play videos on 10.7 and better.
> 
> To open a video, I do the following:
> 
>AVPlayer *p = [[AVPlayer alloc] initWithURL:url];
> 
> I'd expect this code to crash on 10.6 because 10.6 doesn't have AVPlayer.
> To my surprise, however, the code doesn't crash and it just returns NULL.
> This is fine because then my app will just show a message box informing
> the user that the file couldn't be opened and no other AVFoundation APIs
> will be accessed.
> 
> However, I'm wondering whether it is ok to execute this code on 10.6 without
> any safeguard. I thought I'd have to do something like this instead:
> 
>if(floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_7) {
> 
>AVPlayer *p = [[AVPlayer alloc] initWithURL:url];
>...
> 
>} else {
> 
>return NULL;
>}
> 
> Do I have to do this or can I just rely on alloc/init returning NULL for
> classes unknown on 10.6?
> 
> -- 
> Best regards,
> Andreas Falkenhahn  mailto:andr...@falkenhahn.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/pjb%40informatimago.com
> 
> This email sent to p...@informatimago.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: Method name starts with "set"

2016-08-02 Thread Pascal Bourguignon


> Le 2 août 2016 à 07:11, Trygve Inda  a écrit :
> 
> I have a class where I would like to have a method name like:
> 
> -(void)setMaximumOperations:(NSInteger)operations
> {
>  [[self operationQueue] setMaxConcurrentOperationCount:operations];
> 
>   ... Do other stuff ...
> }
> 
> Is this a bad idea? There is no property called "maximumOperations" in my
> class but using a "set" method name in this way may imply there is, although
> the compiler likely doesn't care.
> 
> How is the best way to name something like this?

Actually, there is no difference between a property and a pair of getter/setter 
methods.  Here you have defined a write-only property, and since you have this 
method, you could write: 

   o.maximumOperations=42;

as well as:

   [o setMaximumOperations:42]

The same code is generated in both cases. 

If you added a method -(NSInteger)maximumOperations then you'd have a 
read-write property. 

You can call it a derived property, since it is not implemented directly as a 
slot of your instances. 



-- 
__Pascal Bourguignon__

___

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: How to set a TextField

2016-03-14 Thread Pascal Bourguignon



> On 14 Mar 2016, at 09:17, Gerriet M. Denkmann  wrote:
> 
> You are absolutely right that a background would be the right thing.
> But this is just a small tool for testing, and it will not take more than a 
> few seconds, so I am trying to avoid this.

For testing you can use NSLog instead.

-- 
__Pascal Bourguignon__

___

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: Where are the interface builder components?

2009-11-15 Thread Pascal Bourguignon

From: Sandro Noël sandro.n...@gestosoft.com

But where are the ones from apple... that's what i'm wondering,
Why do we have to duplicate work that evidently has already been done.
I'm confused as why apple is not including it in it's development tools.
it makes no sense to me...


If Apple published the sources of its widgets, Microsoft would have it much 
easier to copy it...


Otherwise, if the question is why there's no market for reusable object 
component, (which was promised by early OO proponents), perhaps it is 
because the OO model is flawed?  Or, I would rather thing that the 
_granularity_ of the OO model is the problem: reusing components at the 
level of an object is too inconvenient; reusing components at the tool level 
(like in unix) seems to be much more successful.


--
__Pascal Bourguignon__

___

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

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

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

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