开发环境:Xcode 9.4.1 、cocos2d-x3.17 lua
跳转lua代码:
local args = {url = "https://itunes.apple.com/cn/app/rise-up/id你的appID号?mt=8"}
local result = luaoc.callStaticMethod("AppStoreInfo","openInfo",args)
log(tostring(result))
AppStoreInfo.h
@interface AppStoreInfo : NSObject{
}
+ (void)openGradeInfo:(NSDictionary *)dict;
//- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController;
@end
AppStoreInfo.m
#import "AppStoreInfo.h"
#import <StoreKit/StoreKit.h>
@implementation AppStoreInfo
+ (void)openInfo:(NSDictionary *)dict{
NSString *url = [dict valueForKey:@"url"];
NSLog(@"%@", url);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url] options:@{} completionHandler:NULL];
}