[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 ?
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?
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]
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.
[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’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