{"id":85,"date":"2006-01-11T11:18:38","date_gmt":"2006-01-11T18:18:38","guid":{"rendered":"http:\/\/www.red-sweater.com\/blog\/85\/kagi-universal"},"modified":"2006-02-21T10:27:12","modified_gmt":"2006-02-21T17:27:12","slug":"kagi-universal","status":"publish","type":"post","link":"https:\/\/redsweater.com\/blog\/85\/kagi-universal","title":{"rendered":"Kagi Universal"},"content":{"rendered":"<p>Now that Apple has announced the immediate availability of Intel-based Macintoshes, the developer community needs to get serious about adjusting our projects so that they build and run natively on the machines.<\/p>\n<p>\nFor a long time, Apple has made available the required SDK for &#8220;dry running&#8221; our projects as Intel-compatible builds. Some developers even took Apple up on the &#8220;transition kit&#8221; systems, which put Intel machines (though quite unlike the shipping units) in the hands of developers from a very early stage.\n<\/p>\n<p>\nA common thread on the mailing lists seems to be the unhappy scenario of essentially having ones own code ported and ready to test, but being held hostage by the slowness of another library upon which you depend. When the library is open source, it&#8217;s easy enough to take responsibility for it yourself. Get your feet dirty and port the dang CurlHandle class over yourself! But many of us (perhaps unwisely) have gotten ourselves into situations where we depend upon the compiled code of others in our shipping products.\n<\/p>\n<p>\nKagi&#8217;s <a href=\"http:\/\/www.kagi.com\/KRM\/index.html\">KRM<\/a> module allows Kagi vendors to present users with an integrated purchasing dialog. It&#8217;s essentially a single dialog that takes the user&#8217;s financial information and ships it off to a Kagi server for further processing.\n<\/p>\n<p>\nFor those of us who have been using the Cocoa-specific version of KRM, the wait has been long for a universal version of the libraries. In fact, the wait will be very long. It doesn&#8217;t appear that Kagi is planning any further updates to the Cocoa-specific module. Instead, we&#8217;re offered the &#8220;<a href=\"http:\/\/www.kagi.com\/KRM\/zonickrm\/index.html\">Zonic KRM<\/a>&#8221; module, which is a straight-C CarbonEvent based solution.\n<\/p>\n<p>\nAt first, I was annoyed by the presumption that Cocoa developers should have to pull up roots and switch to a new library with a new API (a straight-C one, to boot!). But after downloading and using the Zonic KRM solution, I am happy to report that it&#8217;s an overall cleaner and easier to use module than the previous Cocoa-based framework. As a single library archive and associated header file, this requires none of the linking and packaging headaches of the Cocoa KRM package. The API is straightforward and offers few opportunities for careless error. Even the UI is, ironically enough, improved over the Cocoa version.\n<\/p>\n<p>\nThe only major snag I&#8217;ve run into is that the Zonic purchase window doesn&#8217;t appear in the floating layer as the old Cocoa KRM did, and seems to suffer some activation issues when invoked from my LSUIElement application. These types of problems were what originally led me to choose Kagi over eSellerate, whose Carbon-based solution had the same problems. Hopefully these can be resolved with Kagi &#8211; I&#8217;ll have to investigate. [Ed. Note: These issues were more or less mistaken impressions, and are somewhat elaborated upon in updates at the end of this article]\n<\/p>\n<p>\nAll the improvements will mean little, however, to Carbophobic developers who have grown accustomed to avoiding most APIs that don&#8217;t fall firmly into the Cocoa space. I don&#8217;t blame them. If I didn&#8217;t already know this Carbon stuff, I probably wouldn&#8217;t want to sidetrack my rapidly progressing project to figure it out, either.\n<\/p>\n<p>\nIn the spirit of helping these developers out, and with the somewhat selfish goal of encouraging as many Intel-native apps as possible by the time my MacBook arrives, I&#8217;m posting a <a href=\"http:\/\/www.red-sweater.com\/blog\/downloads\/CocoaZonic.zip\">very simple demo project<\/a> that shows how you might integrate the Zonic KRM modules into a Cocoa application. For this example, I&#8217;ve taken the attitude that you want your exposure to Carbon to be brief, handing back control to a &#8220;sane, Cocoa world&#8221; as soon as possible. The gist is pretty simple:\n<\/p>\n<ol>\n<li>User pushes a button, invoking an IBAction method.<\/li>\n<li>Action method installs a Carbon event handler for Zonic &#8220;I&#8217;m Done.&#8221;<\/li>\n<li>Action starts a modeless Zonic registration dialog.<\/li>\n<li>Zonic finishes and issues the Carbon Event.<\/li>\n<li>Callback receives event and passes event-completion structure back to Cocoa.<\/li>\n<\/ol>\n<p>\n[Ed. Note: It has been pointed out that using the &#8220;modal&#8221; Zonic dialog is exceedingly simple, and doesn&#8217;t require any use of the Carbon event API.]\n<\/p>\n<p>\nNote that since I&#8217;m not sure I have the right to redistribute the Zonic library and header file as-is, I&#8217;m not including them in the sample project. You&#8217;ll have to download them directly from Kagi.\n<\/p>\n<p>\nI hope this proves helpful to some of you.<\/p>\n<p>\n<strong>Update<\/strong> &#8211; My LSUIElement problems seem to be worked around by using the modal version of the Zonic dialog API.<\/p>\n<p>\n<strong>Update 2<\/strong> &#8211; Wed, 1\/11\/2006, 1:40PM EST. I&#8217;ve updated the sample project to include demo cases for both Modal and Modeless variants of the Zonic KRM dialog.<\/p>\n<p>\n<strong>Update 3<\/strong> &#8211; Wed, 1\/11\/2006, 1:55PM EST. Another update to the sample &#8211; should dispose of the Zonic result structure when done with it. Also, it should be noted that the &#8220;LSUIElement&#8221; related problems alluded to above are more general. It appears that Zonic KRM&#8217;s modeless dialog is not well suited to being displayed while a Cocoa NSPanel of any kind is being displayed.<\/p>\n<p><strong>Update 4<\/strong> &#8211; Thursday, 1\/12\/2006, 1:55PM EST. Incorporate memory leak fix suggested by Kirk in the comments.<\/p>\n<p><strong>Update 5<\/strong> &#8211; Friday, 1\/13\/2006, 10:48AM EST. Friday the 13th Special! Kagi and Zonic have kindly agreed to let me include the Zonic library and header file in the demo project, so it should be buildable as soon as you download it, presuming you have Xcode 2.2 installed.<\/p>\n<p><strong>Update 6<\/strong> &#8211; Tuesday, 2\/21\/2006. I meant to point this out earlier, but forgot. There is a problem in the 1.0.4 Zonic release that causes it to crash on 10.2 deployments. An ingenious workaround was discovered by another Mac developer and shared with me via Kagi. Simply lipo the PowerPC code from Zonic 1.0.3 with the Intel code from 1.0.4. I&#8217;m using this solution in the interim and it gives a solid fix to the problem the Zonic 1.0.5 release is ready.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that Apple has announced the immediate availability of Intel-based Macintoshes, the developer community needs to get serious about adjusting our projects so that they build and run natively on the machines. For a long time, Apple has made available the required SDK for &#8220;dry running&#8221; our projects as Intel-compatible builds. Some developers even took [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,13,5],"tags":[],"class_list":["post-85","post","type-post","status-publish","format-standard","hentry","category-cocoa","category-intel","category-xcode"],"_links":{"self":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":0,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/85\/revisions"}],"wp:attachment":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/categories?post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/tags?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}