Re: Relative URLs, and string encodings

2017-07-24 Thread Alex Zavatone

> On Jun 1, 2017, at 11:25 AM, Jens Alfke  wrote:
> 
> 
>> On Jun 1, 2017, at 7:44 AM, Jonathan Taylor  
>> wrote:
>> 
>> My attempt like:
>> [NSURL URLWithString:[path 
>> stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding] 
>> relativeToURL:relativeTo];
> 
> Ah, you want NSUTF8StringEncoding instead. Generally speaking, URL encoding 
> always uses UTF-8 nowadays.
> 
>> This had been working ok for some time, but I have just found it to be 
>> broken for filenames containing unusual characters. In particular, it fails 
>> when given a filename containing a “smart quote” (not easily created 
>> directly with the keyboard, but auto-generated as part of a time machine 
>> backup, based on the machine name).
> 
> You mean an open or close (aka “curly”) quote? They’re easily typed with 
> Option-[ and Option-Shift-[.
> 
> —Jens

You can also open the Keyboard menu item or the Character menu item the title 
bar to find special characters.  The Keyboard System Preference allows you to 
enable this.

___

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: Relative URLs, and string encodings

2017-07-24 Thread Charles Srstka
> On Jun 1, 2017, at 9:44 AM, Jonathan Taylor  
> wrote:
> 
> Can anyone help me with the seemingly simple task of creating a relative 
> NSURL for a filesystem object? The catch here (sorry!) is that I really do 
> need backward compatibility to 10.7, which rules out 
> fileURLWithFileSystemRepresentation:isDirectory:relativeToURL: (which I 
> suspect is the “right” way of doing this).
> 
> My attempt like:
> [NSURL URLWithString:[path 
> stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding] 
> relativeToURL:relativeTo];
> 
> This had been working ok for some time, but I have just found it to be broken 
> for filenames containing unusual characters. In particular, it fails when 
> given a filename containing a “smart quote” (not easily created directly with 
> the keyboard, but auto-generated as part of a time machine backup, based on 
> the machine name).
> 
> Although I do not recall why I used 
> stringByAddingPercentEscapesUsingEncoding, I think it must have been because 
> it failed on some other filename pattern if I did not do that.
> 
> String encodings is something I know basically nothing about, I am afraid. I 
> am speculating that what is happening is that the fancy apostrophe is not 
> ASCII and so my code does not work for that filename. I can change the 
> encoding to NSUnicodeStringEncoding, and things seem ok, but I don’t know 
> whether that will now definitely work for all filenames, or whether I have 
> just stored up an even more obscure problem for the future.
> 
> So, finally getting to two actual questions:
> 1. Will unicode encoding give me a robust solution here?
> 2. Is there a differnet, better way (pre-10.9) I should be using to create a 
> relative URL?
> 
> Thanks for any advice
> Jonny.

I’d construct a path using -[NSFileManager 
stringWithFileSystemRepresentation:length:], then make a URL from that using 
+[NSURL fileURLWithPath:].

Charles

___

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 Install El Capitan From Sierra?

2017-07-24 Thread Alex Zavatone

> On May 30, 2017, at 3:25 PM, Quincey Morris 
>  wrote:
> 
> On May 30, 2017, at 12:32 , Richard Charles  wrote:
>> 
>> you can […] select [bootable media from older installers] as your start up 
>> disk from within macOS Sierra
> 
> Not if this Mac is newer than the older macOS. (Think about hardware-level 
> drivers.)

What about VMware Fusion?  It’s 50 bucks.

___

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 Install El Capitan From Sierra?

2017-07-24 Thread Mike Crawford
> What about VMware Fusion?  It’s 50 bucks.

My understanding is that VMware virtualizes the firewire ports, so you
can use the two-machine debugger with just one Macintosh.


Mike
Mike Crawford, Baritone
mdcrawf...@gmail.com

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Mon, Jul 24, 2017 at 2:16 PM, Alex Zavatone  wrote:
>
>> On May 30, 2017, at 3:25 PM, Quincey Morris 
>>  wrote:
>>
>> On May 30, 2017, at 12:32 , Richard Charles  wrote:
>>>
>>> you can […] select [bootable media from older installers] as your start up 
>>> disk from within macOS Sierra
>>
>> Not if this Mac is newer than the older macOS. (Think about hardware-level 
>> drivers.)
>
> What about VMware Fusion?  It’s 50 bucks.
>
> ___
>
> 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/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@gmail.com
___

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

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

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

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


Re: Leak in NSDocument Edge Case

2017-07-24 Thread Jerome Krinock
I filed a bug on this today: 33502122.

> On 2017 Jun 30, at 14:53, Jerome Krinock  wrote:
> 
> It looks to me that, in the edge case where user clicks File : Duplicate and 
> then enters a file path/name that already exists in the filesystem, so that 
> Cocoa prompts to "Replace" or "Cancel", the new NSDocument object gets four 
> (4) unbalanced retains, and therefore leaks.  This is reproducible in macOS 
> 10.12 or 10.13, Swift or Objective-C, ARC or not.
> 
> I say this because a document which has has been created in this way does not 
> dealloc as documents normally do when closed (or a few seconds thereafter), 
> but it does dealloc if I send it four unbalanced -release messages.  And if I 
> send it five unbalanced -release messages, a zombie squeals as expected.
> 
> The `leaks` command-line tool indicates 0 leaks before the File : Duplicate, 
> and 12 leaks after closing the duplicated (and I think leaky) document, 
> including some leaked code blocks, although none of the leaks are a 
> document/NSDocument object per se.
> 
> If no one can find a mistake in my analysis I’ll file a bug.
> 
> Jerry Krinock
> 
> In case you want to see for yourself:
> 
> https://youtu.be/zSQ1hY7JVZs (03:49)
> https://github.com/jerrykrinock/LeakyDocumentDemo
> 
> ACA80004:~ jk$ leaks 4800
> Process: LeakyDocSwiftDemo [4800]
> Path:
> /Users/jk/Library/Developer/Xcode/DerivedData/LeakyDocumentDemo-ctlrylejnnaaxqddgjsbbjsrcnzy/Build/Products/Debug/LeakyDocSwiftDemo.app/Contents/MacOS/LeakyDocSwiftDemo
> Load Address:0x1
> Identifier:  com.sheepsystems.LeakyDocumentSwiftDemo
> Version: 1.0 (1)
> Code Type:   X86-64
> Parent Process:  debugserver [4801]
> 
> Date/Time:   2017-06-30 14:27:22.798 -0700
> Launch Time: 2017-06-30 14:24:29.663 -0700
> OS Version:  Mac OS X 10.12.6 (16G23a)
> Report Version:  7
> Analysis Tool:   /Applications/Xcode.app/Contents/Developer/usr/bin/leaks
> Analysis Tool Version:  Xcode 8.3.3 (8E3004b)
> 
> 
> leaks Report Version:  2.0
> Process 4800: 45412 nodes malloced for 6440 KB
> Process 4800: 12 leaks for 608 total leaked bytes.
> Leak: 0x608000221f40  size=32  zone: DefaultMallocZone_0x100ea5000   CFString 
> (Storage)  C  CoreFoundation  length: 4  has-length-byte:  "doc1"
> Leak: 0x608000222c40  size=32  zone: DefaultMallocZone_0x100ea5000   
> __NSExactBlockVariable__  __block variable  CoreFoundation
>   0x 0x 0x00222c40 0x6080 @,"..`..
>   0x2104 0x0020 0x0045d200 0x6000 ...! .E..`..
> Leak: 0x608000222c60  size=32  zone: DefaultMallocZone_0x100ea5000   
> __NSExactBlockVariable__  __block variable  CoreFoundation
>   0x 0x 0x00222c60 0x6080 `,"..`..
>   0x2104 0x0020 0x00104f01 0x6000 ...! O...`..
> Leak: 0x608000256620  size=48  zone: DefaultMallocZone_0x100ea5000   
> __NSMallocBlock__  ObjC  CoreFoundation  AppKit  __75-[NSWindow 
> _titlebarEditingDidEndNormally:title:editingRange:grantHandler:]_block_invoke_3
>   0x7fff8cb68ce9
> Leak: 0x60800025a280  size=48  zone: DefaultMallocZone_0x100ea5000   
> __NSMallocBlock__  ObjC  CoreFoundation  AppKit  __77-[NSDocument 
> duplicateDocumentWithDelegate:didDuplicateSelector:contextInfo:]_block_invoke.2577
>   0x7fff8c7f24a5
> Leak: 0x60800025d220  size=48  zone: DefaultMallocZone_0x100ea5000   
> __NSMallocBlock__  ObjC  CoreFoundation  AppKit  
> __81-[NSDocument(NSDocumentSerializationAPIs) 
> _activityCompletionHandlerForActivity:]_block_invoke  0x7fff8c89437b
> Leak: 0x60800025d2e0  size=48  zone: DefaultMallocZone_0x100ea5000   
> NSMutableArray  ObjC  CoreFoundation  item count: 5
> Leak: 0x608000279e80  size=64  zone: DefaultMallocZone_0x100ea5000   CFString 
>  ObjC  CoreFoundation  length: 4  mutable non-inline:  "doc1"
> Leak: 0x608000462880  size=64  zone: DefaultMallocZone_0x100ea5000   
> _NSDocumentActivity  ObjC  AppKit
>   0xa9241079 0x001d 0x0001 0x y.$.
>   0x 0x 0x00464400 0x6080 .DF..`..
>   0x0101 0x 0x0025d2e0 0x6080 ..%..`..
>   0x00465c00 0x6080 0x 0x .\F..`..
> Leak: 0x608000464400  size=64  zone: DefaultMallocZone_0x100ea5000   
> __NSMallocBlock__  ObjC  CoreFoundation  AppKit  __77-[NSDocument 
> duplicateDocumentWithDelegate:didDuplicateSelector:contextInfo:]_block_invoke_4
>   0x7fff8c7f1dd9
> Leak: 0x608000465c00  size=64  zone: DefaultMallocZone_0x100ea5000   
> __NSMallocBlock__  ObjC  CoreFoundation  AppKit  __77-[NSDocument 
> duplicateDocumentWithDelegate:didDuplicateSelector:contextInfo:]_block_invoke.2594
>   0x7fff8c7f27e2
> Leak: 0x608000466440  size=64  zone: DefaultMallocZone_0x100ea5000   
> __NSMallocBlock__  ObjC  CoreFoundation  AppKit  __75-[NSWindow 
> _titlebarEditingDidEndNormally:title:editingRange:grantHandler:]_block_invoke.4316
>   0x7fff8cb68a73
> ACA80004:~ 

In app purchase + redeem points as gift vouchers

2017-07-24 Thread Devarshi Kulshreshtha
We are developing a multiplayer game in which user has to buy some credit
point through in app purchase, then he can multiply those points by winning
multiplayer challenges with friends. On reaching a certain level of points,
he can reward himself by re-deeming gift vouchers (amazon, ebay, etc)
through those points. Does apple allow this type of game structure? Please
suggest.

-- 
Thanks,

Devarshi
___

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