Detecting user termination of an iOS auto-renewing subscription

2016-09-25 Thread Lou Zell
Hi all,

Using the App Store receipt verification system, is there a way to detect
when an auto-renewing iOS subscriber terminates their subscription _before_
the expiration date of their current subscription passes?

I am referring to a user going through:
iTunes > Account > View My Account > Settings > Subscriptions > Manage and
choosing to end their subscription.

AFAIK it is impossible to terminate a subscription via the sandbox purchase
system (a monthly subscription renews automatically at five minute
intervals for a total of 6 times and then stops), so I don't know how to
test this situation.

I believe the "cancel_date" and "cancel_date_ms" properties of a receipt
from the purchase system will _not_ be set in this case, as the guidance
around these terms say to "Treat a canceled receipt the same as if no
purchase had ever been made", which is not the same as terminating a
subscription before the next auto-renew date.

Are there any receipt fields that I could use to determine that a user has
terminated their auto-renew subscription?

At the end of the day we'd like to identify customers that are about to
leave!  Any guidance on this would be much appreciated!

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: formatted strings in Swift

2016-09-03 Thread Lou Zell
On Fri, Sep 2, 2016 at 10:02 PM, Gerriet M. Denkmann 
wrote:
>
> How to create a formatted string?
>

I use a little helper workaround that essentially looks like this:

let str = "hi".nulTerminatedUTF8
let padded = str.withUnsafeBufferPointer() {
return String(format: "%10s", $0.baseAddress!)
}
print(padded)
// prints:hi
___

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: Proper setup for embedded framework

2016-08-19 Thread Lou Zell
Ok, through some trials in the WorkspaceExperiment [1] I've got the magic
ordering:

To embed a framework that's the output of a sibling project within the same
Xcode workspace:

1. Build HelloFramework for iOS, _not_ for simulator
2. Go to Project Navigator > HelloApp > Target > Build Phases
3. Add HelloFramework to the Link Binary With Libraries phase
4. Back in Project Navigator, the linked framework will appear under
HelloApp, select it
5. Open the utilities pane (cmd+opt+0)
6. Change the Location of HelloFramework to "Relative to Build Products"
7. Back in Build Phases for HarpApp, Create an additional Copy Files phase
8. Set the Destination to "Frameworks"
9. Add the HelloFramework that's nested under HelloApp


[1] https://github.com/lzell/WorkspaceExperiment

On Tue, Aug 16, 2016 at 7:50 AM, Lou Zell <lzel...@gmail.com> wrote:

> Thanks Quincey,
>
> 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.
>
>
> When I tap on the plus sign next to the Target Dependencies build phase,
> the framework target is not listed as an option.  That is, targets from the
> sibling project (the framework project) are not found by whatever Xcode's
> default rules are.
>
> Apple's doc on workspaces states:
>
> Each workspace has its own build directory. Because all of the files in
>> all of the projects in a workspace are in the same build directory, all of
>> these files are visible to each project.
>
>
> So it seems to me this should be possible.  I.E. one workspace, multiple
> projects, one project is a framework that is a dependency for all other
> sibling projects.  Here's a distilled sample project:
>
> https://github.com/lzell/WorkspaceExperiment
>
> I'm wondering if there is a build setting to edit or what that will make
> targets from sibling projects be recognized as possible dependencies
>
>
> On Mon, Aug 15, 2016 at 8:18 PM, Quincey Morris <quinceymorris@
> rivergatesoftware.com> wrote:
>
>> On Aug 15, 2016, at 19:28 , Lou Zell <lzel...@gmail.com> 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

Re: Proper setup for embedded framework

2016-08-19 Thread Lou Zell
Thanks Quincey,

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.


When I tap on the plus sign next to the Target Dependencies build phase,
the framework target is not listed as an option.  That is, targets from the
sibling project (the framework project) are not found by whatever Xcode's
default rules are.

Apple's doc on workspaces states:

Each workspace has its own build directory. Because all of the files in all
> of the projects in a workspace are in the same build directory, all of
> these files are visible to each project.


So it seems to me this should be possible.  I.E. one workspace, multiple
projects, one project is a framework that is a dependency for all other
sibling projects.  Here's a distilled sample project:

https://github.com/lzell/WorkspaceExperiment

I'm wondering if there is a build setting to edit or what that will make
targets from sibling projects be recognized as possible dependencies


On Mon, Aug 15, 2016 at 8:18 PM, Quincey Morris <
quinceymor...@rivergatesoftware.com> wrote:

> On Aug 15, 2016, at 19:28 , Lou Zell <lzel...@gmail.com> 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

side by side xcode, open scripts

2011-08-16 Thread Lou Zell
Just giving back a little here in case anyone else is struggling with side
by side Xcode3 and 4.  Two quick scripts are below.  Xcode3 is installed at
/Xcode3, and Xcode4 at /Xcode4.

xcode3 open script:
#!/bin/bash
open /Xcode3/Applications/Xcode.app --args `cd $1; pwd`

xcode4 open script:
#!/bin/bash
open /Xcode4/Applications/Xcode.app --args `cd $1; pwd`

So say you have a project in ~/dev/YourProject, you can open it in either
Xcode with:

~/dev/YourProject $ xcode3(4) YourProject.xcodeproj


One question I have: I'm not really sure what xcode-select gets me, should I
be adding this to the scripts:

sudo xcode-select -switch /Xcode3

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

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


getting a unique ID to store IAPs in keychain

2011-08-10 Thread Lou Zell
Hi Devs,

I'm storing non-consumable In-App Purchases in the Keychain.  I would like
to query the Keychain using a key that is specific to the iTunes account
that was used to make the purchase.  It doesn't have to be the exact iTunes
account name, just something that is unique per account.  Does something
like this exist?

Here is my dilema, in case there is a better way to approach this:

I have a UI element that kicks off -[SKPaymentQueue
restoreCompletedTransactions] so that users that have changed devices can
get their IAPs back.  Now, without a unique ID that's tied to an iTunes
account, there is no stopping someone from logging in as their buddy (a
buddy that has already purchased all IAPs), opening my app and clicking on
Restore, then logging back into their own account.  If there was a unique ID
that I could query the keychain on, then as soon as the accounts switched
back the IAPs would no longer be unlocked.

Am I thinking about this correctly?  Oh, and just to preempt it, I know I'm
being overly paranoid :), just wondering if there is something in place for
this.

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

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


Cocoa alternative for method aliasing?

2011-03-29 Thread Lou Zell
Mornin' Devs,

Is there a recommended pattern for passing events up the responder chain
without subclassing a class and overriding the methods I'm interested in?
 Here is an explanation of what I'm trying to do:

I have a subclass of UIButton, call it MyButton, that I would like to
function as a vanilla UIButton but also pass touch events to the next
responder (I'm interested in eventually getting the events in
UIViewController).  I can do something like this in MyButton:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
  [[self nextResponder] touchesBegan:touches withEvent:event];
}

But then I lose the touch handling that makes a UIButton different from just
a plain old UIView (e.g. highlight states).  I could use [self
setHighlighted:YES], for example, to fix that problem.  What I really want
to do, though, is something like this:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
  [self originalTouchesBegan:touches withEvent:event];
  [[self nextResponder] touchesBegan:touches withEvent:event];
}

Something analogous to ruby's alias.  I haven't found anything built in for
method aliasing, which leads me to believe there is another way to approach
this.  Does anyone have a good approach?

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

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


Re: Cocoa alternative for method aliasing?

2011-03-29 Thread Lou Zell
David, Matt,

Thanks for the responses and pointing me towards UIControlEvents.


 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
 {
   [[self nextResponder] touchesBegan:touches withEvent:event];
 }

 Don't do that. The way to pass touches up the responder chain is by calling
 super. This will do exactly what you're after, I think.


Using super will call -touchesBegan:withEvent of UIButton.  Which, in my
experiments, does not continue to pass the event up the responder chain --
i.e. I never see the touch events reach my UIViewController (where I want
them to end up).  My understanding is that once an object is found that
responds to -touchesBegan:withEvent, the event propagation ends unless
explicitly forwarded.  Calling super will get the event to my superclass
(UIButton), but not beyond that.

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

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


Re: Cocoa alternative for method aliasing?

2011-03-29 Thread Lou Zell
On Tue, Mar 29, 2011 at 5:16 PM, WT jrca...@gmail.com wrote:

 On Mar 29, 2011, at 4:25 PM, Matt Neuburg wrote:

  On Tue, 29 Mar 2011 11:20:31 -0700, Lou Zell lzel...@gmail.com said:
  I have a subclass of UIButton, call it MyButton, that I would like to
  function as a vanilla UIButton but also pass touch events to the next
  responder (I'm interested in eventually getting the events in
  UIViewController).  I can do something like this in MyButton:
 
  -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  {
  [[self nextResponder] touchesBegan:touches withEvent:event];
  }
 
  Don't do that. The way to pass touches up the responder chain is by
 calling super. This will do exactly what you're after, I think.
 
  However, as already implied, you might be better off with a different
 architecture. It isn't at all clear why you'd do what you're describing. Let
 the button act as a button. If you need further information about what's
 going on, consider a gesture recognizer, perhaps, or just use the button's
 control events. In any case there should be no need to interfere at the very
 low level of the touches... responder methods. There are *many* ways to
 interfere with aspects of touch delivery; they are quite interesting, but be
 careful or you'll break something.
 
  m.

 Moreover, according to the Event Handling Guide for iOS,


 http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/MultitouchEvents/MultitouchEvents.html

 Important: If your custom responder class is a subclass of UIView or
 UIViewController, you should implement all of the methods described in “The
 Event-Handling Methods.” If your class is a subclass of any other UIKit
 responder class, you do not need to override all of the event-handling
 methods; however, in those methods that you do override, be sure to call the
 superclass implementation of the method (for example, super
 touchesBegan:touches withEvent:theEvent];). The reason for this guideline is
 simple: All views that process touches, including your own, expect (or
 should expect) to receive a full touch-event stream. If you prevent a UIKit
 responder object from receiving touches for a certain phase of an event, the
 resulting behavior may be undefined and probably undesirable.

 and, further down,

 Handling Events in Subclasses of UIKit Views and Controls
 If you subclass a view or control class of the UIKit framework (for
 example, UIImageView or UISwitch) for the purpose of altering or extending
 event-handling behavior, you should keep the following points in mind:

 - Unlike in a custom view, it is not necessary to override each
 event-handling method.
 - Always invoke the superclass implementation of each event-handling method
 that you do override.
 - Do not forward events to UIKit framework objects.

 W.


Yikes, thanks for pointing that out!
___

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


Re: Using NSWindow without NIB (XIB) file ?

2011-01-25 Thread Lou Zell
On Tue, Jan 25, 2011 at 2:48 AM, David Remacle lis...@clampin.com wrote:

 Hello

 Is it possible to use NSWindow without NIB file ?


Below is a code sample I put together when I was trying to accomplish the
same thing.  I was pretty against Interface Builder when I first started
with Cocoa because it felt a bit too magical.  Since then I have seen the
light, as they say.  Anyway, here it is, name it WindowNoIB.m:

// Compile and run with:
// $ gcc WindowNoIB.m -Wall -lobjc -framework Foundation -framework AppKit
-o WindowNoIB  ./WindowNoIB
#import Foundation/Foundation.h
#import AppKit/AppKit.h

// MyClass is going to be the NSApplicationDelegate.  See this:
//
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSApplicationDelegate_Protocol/Reference/Reference.html
@interface MyClass:NSObject{
}
@property (nonatomic, retain) NSWindow *window;
@end

@implementation MyClass
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
  NSLog(@Finished Launching %@, notification);

  NSWindow *localWindow = [[NSWindow alloc] initWithContentRect:[[NSScreen
mainScreen] frame]

 styleMask:NSResizableWindowMask

 backing:NSBackingStoreBuffered
  defer:NO];
  [self setWindow:localWindow];
  [localWindow release];

  NSView *localView = [[NSView alloc] init];
  [window setContentView:localView];
  [localView release];

  [window setLevel:NSFloatingWindowLevel];
  [window makeKeyAndOrderFront:self];
}
@end

int main (int argc, const char *argv[]) {
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

  // The first time sharedApplication is called, it creates an instance of
NSApplication
  //
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html
  [NSApplication sharedApplication];

  NSLog(@%@, NSApp);

  MyClass *myClass = [[MyClass alloc] init];
  [NSApp setDelegate:myClass];
  [NSApp run];

  [myClass release];
  [pool release];

  return (0);
}

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

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


Generating a low level key event with pre-Leopard HID APIs

2011-01-03 Thread Lou Zell
Hi all,

First time poster here; rest assured, I have searched the archives
extensively before coming to this.  The short of it is I am trying to
generate key events at a level that MAME OS X will see.  MAME uses the
pre-Leopard HID APIs to:

1. Find your keyboards
2. Find all keys on your keyboards
3. Iterate over the keys and add them to a queue (interfaced by
IOHIDQueueInterface)
4. Set a callback function that is called when the event queue transitions
to non-empty

I set up an xcode project, ListenForKeys, to illustrate the process here:
https://github.com/lzell/ListenForKeysOSX/blob/master/ListenForKeys.m

Because of this setup, generating key events in any of the normal ways
doesn't make it to MAME.  I have been searching for a way to specify an
IOHIDElementCookie with an event, hoping that this would cause the event to
find its way into the event queue.  But I have had no luck coming up with
such a function.

I set up a second project to show the many different ways I am generating
key events.  None of these methods cause the event to make it into the event
queue setup in ListenForKeys:
https://github.com/lzell/GenerateKeyPressOSX/blob/master/GenerateKeyPress.m

So, how would I go about generating an event that _would_ make it into the
event queue setup in ListenForKeys, and hence, MAME OS X?  I have been
working on this for quite some time; any help would really be appreciated.

Thank you,
Lou Zell
___

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