Good afternoon, I have a question about InAppPurchases Auto-Renewable Subscription.
Paid subscriptions can be cancelled at any time.
Where and when to check the expiration date (and possible cancellation date) inside the application ?
Do I need to call restoreCompletedTransactions every time in didFinishLauchingWithOptions to get the current date ?
Post
Replies
Boosts
Views
Activity
Good afternoon.
I have such a question. When I download the app in the app store, I will be asked:
"Is your app designed to use cryptography or does it contain or incorporate cryptography?".
I have a private library that I license for each individual project.
I am provided with project parameters (Application name, BundleID, etc.).
And I generate (independently, manually) several keys, I use for base64 and AES256.
Then I insert these constants into the library.
The library has a security mechanism.
Every time an application that uses my library is launched, it extracts some project parameters, converts them to AES256/base64, and compares them with its constants.
If they differ, it means that the framework was inserted into a project for which I did not license the use of the framework.
What should I choose in iTunes connect ? Does my application (which uses a library that has a pirate protection mechanism) use encryption ?
P.S.
I also have a class in the library that contains different methods for converting NSString to NSData and vice versa.
Below it will be .h file. I only use a part of them, just to check the license.
THE LICENSE is checked locally on the device ! I don't send the data anywhere.
objective-c
/*
CommonHMAC-------------------------------------------------*/
@interface NSData (CommonHMAC) (NSData*) HMACWithAlgorithm:(CCHmacAlgorithm) algorithm;
(NSData*) HMACWithAlgorithm:(CCHmacAlgorithm) algorithm key:(id)key;
@end
/*
CommonCryptor--------------------------------------------------------*/
@interface NSData (CommonCryptor) (NSData*) AES256EncryptedDataUsingKey:(id)key error:(NSError **) error;
(NSData*) decryptedAES256DataUsingKey:(id)key error:(NSError **) error;
(NSData*) DESEncryptedDataUsingKey:(id)key error:(NSError **) error;
(NSData*) decryptedDESDataUsingKey:(id)key error:(NSError **) error;
(NSData*) CASTEncryptedDataUsingKey:(id)key error:(NSError **) error;
(NSData*) decryptedCASTDataUsingKey:(id)key error:(NSError **) error;
@end
/*
CommonDigest--------------------------------------------------------*/
@interface NSData (CommonDigest) (NSData*) MD2Sum;
(NSData*) MD4Sum;
(NSData*) MD5Sum;
(NSData*) SHA1Hash;
(NSData*) SHA224Hash;
(NSData*) SHA256Hash;
(NSData*) SHA384Hash;
(NSData*) SHA512Hash;
@end
Greetings to all apple developers!
I have the problem with NETunnelProviderManager and PacketTunnelProvider.
When I try to make a connection (by OpenVPN), there is an instant disconnect.
I am using OpenVPNAdapter.framework - https://github.com/ss-abramchuk/OpenVPNAdapter for this.
I put nslog in all methods in PacketTunnelProvider and none were printed....
I have the following logs in the console:
objective-c
NEVPNStatusInvalid
Save successfully
Connection established!
NEVPNStatusConnecting
NEVPNStatusDisconnected
I checked all the .entitlements and other parameters.
As I think they are okay.
However, if you could check them again, I would be grateful.
Below I am pasting links to images.
Main target settings - https://ibb.co/zmHRP2z
Extension target settings - https://ibb.co/tQdNNNY
Main target .entitlements - https://ibb.co/SwwY8L8
Extension target .entitlements - https://ibb.co/kJg7q6W
Extension's Info.plist - https://ibb.co/th2xSzm
My code:
objective-c (IBAction) buttonAction:(id)sender
{
[self connection];
}
objective-c (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onVpnStateChange:) name:NEVPNStatusDidChangeNotification object:nil];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"...."]];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
[[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
NSString* requestReply = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSData* responseData = [requestReply dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
weak.configData = [jsonDict[@"config"] dataUsingEncoding:NSUTF8StringEncoding]
[weak initProvider];
}] resume];
}
objective-c(void)initProvider
{
__weak typeof(self) weak = self;
[NETunnelProviderManager loadAllFromPreferencesWithCompletionHandler:^(NSArrayNETunnelProviderManager** _Nullable managers, NSError* _Nullable error) {
if(error){
NSLog(@"error: %@",error); return;
}
weak.providerManager = managers.firstObject ? managers.firstObject : [NETunnelProviderManager new];
[weak.providerManager loadFromPreferencesWithCompletionHandler:^(NSError * _Nullable error) {
if(error){
NSLog(@"initProvider [weak.providerManager loadFromPreferencesWithCompletionHandler] error: %@",error);
return;
}
NETunnelProviderProtocol *tunel = [[NETunnelProviderProtocol alloc] init];
tunel.providerBundleIdentifier = @"....com.MyVPN.PacketTunnel";
tunel.providerConfiguration = @{ @"ovpn" : self.configData };
tunel.serverAddress = @"vpn.superVPN.com";
tunel.disconnectOnSleep = NO;
weak.providerManager.protocolConfiguration = tunel;
weak.providerManager.localizedDescription = @"superVPN";
[weak.providerManager setEnabled:YES];
[weak.providerManager saveToPreferencesWithCompletionHandler:^(NSError *error) {
if(error) {
NSLog(@"Save error: %@", error);
}else {
NSLog(@"Save successfully");
}
}];
}];
}];
}
objective-c (void)connection
{
__weak typeof(self) weak = self;
[self.providerManager loadFromPreferencesWithCompletionHandler:^(NSError * _Nullable error) {
if(!error){
NSError *error = nil;
[weak.providerManager.connection startVPNTunnelAndReturnError:&error];
if(error) {
NSLog(@"Start error: %@", error.localizedDescription);
}else{
NSLog(@"Connection established!");
}
}else{
NSLog(@"connection error:%@",error);
}
}];
}
I just don't know what the problem might be. Maybe in PacketTunnelProvider ?
The code for PacketTunnelProvider was taken from here. - https://github.com/yaooort/OpenVPN-IOS/blob/master/PacketTunnel/PacketTunnelProvider.m
All tests I run on a real device (iPhone iOS 12.4.4)
Xcode Version 12.4 (12D4e)
My .ovpn file is correct because it good works on android version of application.
Please help me, I don't know where to look for the answer.
There are similar questions on stackoverflow, but no one answered them.
PacketTunnelProvider.m - https://developer.apple.com/forums/content/attachment/b4213a5d-8e30-4524-bf5d-94876235c908