小编ihy*_*ihy的帖子

SKPaymentQueue updatedTransactions未被调用

我得到"这个应用程序购买已经被购买它将被免费恢复"但代表updatedTransactions没有被调用,没有任何反应,IAP没有执行.

我已经实现了恢复购买,它工作正常,但我如何阻止用户再次购买非消耗品?为什么没有调用委托updatedTransactions(SKPaymentTransactionState.Restored)?

即使在删除并重新安装应用程序后进行购买也会显示此弹出窗口.

这是我的代码.如果我做错了,请告诉我.谢谢

func makePaymentForProduct(product:SKProduct){
    let payment = SKPayment.init(product: product)
    SKPaymentQueue.defaultQueue().addPayment(payment)
    SKPaymentQueue.defaultQueue().addTransactionObserver(self)
}

func restorePurchases(){
    SKPaymentQueue.defaultQueue().restoreCompletedTransactions()
    SKPaymentQueue.defaultQueue().addTransactionObserver(self)
}


//MARK: SKProductsRequestDelegate

func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse) {
    self.delegate?.didGetProducts(response.products)
}

func request(request: SKRequest, didFailWithError error: NSError) {
    self.delegate?.purchaseFailed(error.localizedDescription)
}

//MARK: SKPaymentTransactionObserver

func paymentQueue(queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {

    for (_, transaction) in transactions.enumerate() {
        switch (transaction.transactionState) {
        case SKPaymentTransactionState.Purchased:
            self.completeTransaction(transaction)
            break
        case SKPaymentTransactionState.Restored:
            self.restoreTransaction(transaction)
            break
        case SKPaymentTransactionState.Failed:
            self.failedTransaction(transaction)
            break
        default:
            break
        }
    }
}

func completeTransaction(transaction:SKPaymentTransaction){
    self.delegate?.purchaseSuccessful()
    SKPaymentQueue.defaultQueue().finishTransaction(transaction)
}

func …
Run Code Online (Sandbox Code Playgroud)

storekit ios swift skpaymenttransaction

13
推荐指数
1
解决办法
2915
查看次数

Openfire会议iOS实施

我在安装了openfire会议的EC2 ubuntu服务器上设置了openfire.使用管理控制台http:// myserver:9090 /配置焦点用户,测试用户,群聊和内容.

多用户视频会议使用https:// myserver:7443/ofmeet /?r = testroom在Chrome浏览器上正常运行.

现在我想在iOS应用程序中实现这一点,我不知道从哪里开始.我确实调查了一些演示项目,但仍然无法弄明白.

有人可以帮忙吗?如果有人使用过这样的东西,请告诉我.谢谢

xmpp openfire ios webrtc

11
推荐指数
1
解决办法
583
查看次数

在创建的相册中保存视频

我在AppDelegate方法中使用此代码创建了一个专辑

NSString *albumName=@"999Videos";
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library addAssetsGroupAlbumWithName:albumName
                         resultBlock:^(ALAssetsGroup *group) {
                             NSLog(@"added album:%@", albumName);
                         }
                        failureBlock:^(NSError *error) {
                            NSLog(@"error adding album");
                        }];
Run Code Online (Sandbox Code Playgroud)

现在我想将录制的视频保存到这个创建的999Videos专辑中.不是我这样做的photosAlbum.

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
    if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:outputFileURL])
    {
        [library writeVideoAtPathToSavedPhotosAlbum:outputFileURL
                                    completionBlock:^(NSURL *assetURL, NSError *error)
Run Code Online (Sandbox Code Playgroud)

视频正在保存但不在999Videos相册中.有人可以告诉我如何将视频保存到我的自定义相册中?

iphone video ios alassetslibrary

9
推荐指数
1
解决办法
2561
查看次数

使用蓝牙在另一台设备上播放歌曲

我在我的应用程序中有这个歌曲的播放列表.我想使用蓝牙在这个播放列表上播放另一个设备(iphone)上的歌曲.

这就是我所做的

#import "BrowseStationsViewController.h"

@interface BrowseStationsViewController (){
GKSession *gkSession;
}

@end

@implementation BrowseStationsViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
 }

#pragma mark - 
  - (void)viewDidLoad
{
   [super viewDidLoad];
// Do any additional setup after loading the view

   [self setupSession];

NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];

// Register for notifications when the application leaves the background state
// on its way to becoming the active application.
[defaultCenter addObserver:self …
Run Code Online (Sandbox Code Playgroud)

iphone bluetooth gamekit gksession ios

9
推荐指数
1
解决办法
541
查看次数

NSLocale国家代码和名称为空

我使用下面的代码和国家名称,但它返回null.

NSLocale *locale = [NSLocale currentLocale];
NSString *countryCode = [locale objectForKey: NSLocaleCountryCode];
NSString *country = [locale displayNameForKey: NSLocaleCountryCode value: countryCode];
NSLog(@"Language : %@ Lang2 : %@",[[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0],[[NSLocale preferredLanguages] objectAtIndex:0]);
NSLog(@"Locale:%@ Code:%@ Name%@:", locale, countryCode, country);

developmentRegion = English;
        hasScannedForEncodings = 0;
        knownRegions = (
            en,
            Base,
            fr,
            de,
            nl,
            ja,
            es,
            tr,
            it,
            pl,
            pt,
        );
Run Code Online (Sandbox Code Playgroud)

日志:区域设置:<__ NSCFLocale:0x7fbef943f810>代码:(null)名称(null)

语言:nl Lang2:nl

在此输入图像描述

在设备上测试了和simulator.i不知道什么在here.It去应该工作fine.Please让我知道,如果你们有任何idea.i我使用的Xcode 6.4.

在此输入图像描述

ios nslocale xcode6

8
推荐指数
1
解决办法
1399
查看次数

UIPickerView中的行分隔符

如何在我的选择器视图中隐藏分隔符.这是截图 在此输入图像描述.

这是我的自定义UIPickerView的代码.

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {

UILabel *label=[[UILabel alloc]init];
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor whiteColor];
label.textAlignment=NSTextAlignmentCenter;

switch (component) {
    case 0:
        label.text=[_hourArray objectAtIndex:row];
        label.font = [UIFont fontWithName:@"MYRIADPRO-REGULAR" size:70];
        break;

    case 1:
        label.text=[_minutesArray objectAtIndex:row];
        label.font = [UIFont fontWithName:@"MYRIADPRO-REGULAR" size:70];
        break;

    case 2:
        label.text=[_ampmArray objectAtIndex:row];
        label.font = [UIFont fontWithName:@"MYRIADPRO-REGULAR" size:15];

        break;

    default:
        break;
}
return label;
}

-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return 3;
}
Run Code Online (Sandbox Code Playgroud)

请帮帮我.谢谢

iphone uipickerview ios7

6
推荐指数
1
解决办法
8013
查看次数

自定义字体在WKWebView Swift中不起作用

试图在WKWebView中使用自定义字体,但没有运气.

let htmlString = "<span style=\"font-family: 'OpenSans-Bold'; font-size: 30; color: white\">\(Utils.aboutUsText)</span>"
webView.loadHTMLString(htmlString, baseURL: nil)
Run Code Online (Sandbox Code Playgroud)

我可以使用HelveticaNeue-Bold并且效果很好,但不能使用上面的自定义字体.

let htmlString = "<span style=\"font-family: 'HelveticaNeue'; font-size: 30; color: white\">\(Utils.aboutUsText)</span>"
webView.loadHTMLString(htmlString, baseURL: nil)
Run Code Online (Sandbox Code Playgroud)

我已正确添加自定义字体.查看截图.

有人可以告诉我如何实现这一目标或指出我正确的方向.

在此输入图像描述

在此输入图像描述

在此输入图像描述

xcode ios swift wkwebview swift4

4
推荐指数
1
解决办法
3740
查看次数

UILabel有不同的字体

我有这个字符串,我想在标签中显示:

 NSString *criticsScore=[NSString stringWithFormat:@"%@\%%",[dict objectForKey:@"critics_score"]];

 _criticRating.text=criticsScore;
Run Code Online (Sandbox Code Playgroud)

我想设置一个小字体\%%和一个大字体[dict objectForKey:@"critics_score"]];
这是否可能?

objective-c ios

0
推荐指数
1
解决办法
5211
查看次数