is StoreKit framework available ?

Well, in app purchase is a top feature but it was not what I am trying to test.

I am trying to display an app store product sheet inside my app.

The Obj-C code seems really simple but I am not able to make it work in Xojo on my device…

 SKStoreProductViewController *storeViewController = 
              [[SKStoreProductViewController alloc] init];

        storeViewController.delegate = self;

        NSDictionary *parameters =
             @{SKStoreProductParameterITunesItemIdentifier: 
                  [NSNumber numberWithInteger:333700869]};

        [storeViewController loadProductWithParameters:parameters 
             completionBlock:^(BOOL result, NSError *error) {
            if (result)
                [self presentViewController:storeViewController
                                   animated:YES
                                 completion:nil];
        }];

[quote=173209:@Martinho Dos Santos]Well, in app purchase is a top feature but it was not what I am trying to test.

I am trying to display an app store product sheet inside my app.

The Obj-C code seems really simple but I am not able to make it work in Xojo on my device…

[code]
SKStoreProductViewController *storeViewController =
[[SKStoreProductViewController alloc] init];

    storeViewController.delegate = self;

    NSDictionary *parameters =
         @{SKStoreProductParameterITunesItemIdentifier: 
              [NSNumber numberWithInteger:333700869]};

    [storeViewController loadProductWithParameters:parameters 
         completionBlock:^(BOOL result, NSError *error) {
        if (result)
            [self presentViewController:storeViewController
                               animated:YES
                             completion:nil];
    }];

[/code][/quote]

Why don’t you simply use an HTMLViewer and point to the iTunes web site ?

in order to stay in the app.
the user will be able to dismiss the product sheet without leaving the app

please understand that in order to do this, we’ll need a dozen classes, tons of methods and a lot of delegates.
I’ll take time.

[quote=173222:@Christian Schmitz]please understand that in order to do this, we’ll need a dozen classes, tons of methods and a lot of delegates.
I’ll take time.[/quote]

to do what ? in app purchase or display product sheet ?

both :slight_smile:

I’ll look into that, but first I get my newest Kit finished.

[quote=173230:@Christian Schmitz]both :slight_smile:

I’ll look into that, but first I get my newest Kit finished.[/quote]
And then the iCloud Storage APIs? Many thanks :wink:

+10

I tried to use Joe’s code to open a framework that’s not loaded, but no success. What kind of input does the method expect? “com.Apple.Whatsoever” or another kind of name?

Just the framework name. So UIKit, MessageUI, StoreKit, etc.

Thanks, Jason! And you had success with that method? I always receive a NIL ptr.

I modified it a little to fit some other recommendations about caching pointers. Here is the code I use in iOSKit:

[code]Function LoadFramework(frameworkName as Text) As Ptr
static frameworkHandlesDict as xojo.Core.Dictionary = new xojo.Core.Dictionary

if frameworkHandlesDict.HasKey(frameworkName) then Return frameworkHandlesDict.Value(frameworkName)
Declare Function dlopen Lib “/usr/lib/libSystem.dylib” ( path As CString, mode As Int32 ) As Ptr
Declare Function dlerror Lib “/usr/lib/libSystem.dylib” () As CString

Const RTLD_LAZY = 1
Const RTLD_GLOBAL = 8

dim path as Text = “/System/Library/Frameworks/” + frameworkName + “.framework/” + frameworkName
Dim result As ptr = dlopen(path.ToCString(xojo.core.TextEncoding.UTF8), RTLD_LAZY Or RTLD_GLOBAL )

If result = Nil Then
Dim reason As Text = Text.FromCString(dlerror(), Xojo.Core.TextEncoding.UTF8)
Dim exc As New Xojo.Core.InvalidArgumentException
exc.Reason = reason
Raise exc
Return nil
end if

frameworkHandlesDict.Value(frameworkName) = result
return result
End Function[/code]

Brilliant, Jason, thanks a lot! That did it!

You’re welcome!

Respectfully, if I’m trying to load a library and it fails, I want an exception to tell me so, otherwise hard to find bugs will ensue since you will likely assume that the library loaded successfully. Is there some use that I’m overlooking?

Not being Jean-Paul, I implemented his proposal but the other way round, with a SuppressException optional Boolean. But only for debugging purposes – I have an iOS table of open bundles and can check if I am able to load a framework immediately but without crash by simply returning a success Boolean. Besides debugging, I cannot see any use for running without exception when a framework I need is not available.

To have an answer for the OP now: Yes, StoreKit is available!

[quote=176060:@Ulrich Bogun]To have an answer for the OP now: Yes, StoreKit is available!
[/quote]
I’m working on adding it to iOSKit. There are many classes and it is taking slightly longer than expected, however.

I have a couple of problems here with blocks :frowning:
We’ll see what will work in the next weeks.

I’m basically done implementing the classes for StoreKit and need a few beta testers to make sure everything is working correctly before I release them as an update to iOSKit. If you are interested in testing the classes, please see:
https://forum.xojo.com/21554-i-need-some-storekit-in-app-purchase-beta-testers