gpt4 book ai didi

ios - 警告 : Attempt to present UINavigationController on UIViewController which is already presenting

转载 作者:行者123 更新时间:2023-11-30 12:22:44 25 4
gpt4 key购买 nike

我有一个关于 React Native 的模块,并在这个问题的标题中抛出错误。这是模块的代码,我不知道 swift 或 Objective-C,所以我需要你像“swift for idiots”一样解释我

#import "CheckoutMercadoPagoModule.h"
#import "AppDelegate.h"

@import MercadoPagoSDK;

@implementation CheckoutMercadoPagoModule

RCT_EXPORT_MODULE()

- (dispatch_queue_t)methodQueue
{
return dispatch_get_main_queue();
}

RCT_EXPORT_METHOD(startCheckout:(NSString *)publicKey:(NSString *)prefId:(RCTPromiseResolveBlock)resolve:(RCTPromiseRejectBlock)reject) {

[MercadoPagoContext setPublicKey: publicKey];
[MercadoPagoContext setSiteID:@"MLA"];

UINavigationController *checkoutFlow = [MPFlowBuilder startCheckoutViewController:prefId callback:^(Payment *payment) {
NSDictionary *dictionary = @{@"id": payment._id, @"status": payment.status};
resolve(dictionary);
} callbackCancel:nil];

AppDelegate *share = (AppDelegate *)[UIApplication sharedApplication].delegate;
UINavigationController *nav = (UINavigationController *) share.window.rootViewController;
[nav presentViewController:checkoutFlow animated:YES completion:^{}];
}

@end

最佳答案

尝试在 Window 本身而不是 rootviewcontroller 上呈现

  [share.window presentViewController:checkoutFlow animated:YES completion:^{}];

}

关于ios - 警告 : Attempt to present UINavigationController on UIViewController which is already presenting,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44592760/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com