nullptrx / pangle_flutter

Flutter版穿山甲SDK,支持Android、iOS。A Flutter plugin that supports Pangle SDK on Android and iOS.
MIT License
126 stars 43 forks source link

IOS: type 'BUAdSDKManager' has no member 'setIsPaidApp' #69

Closed cipchk closed 2 years ago

cipchk commented 2 years ago

1.简述问题

在一个新项目中使用 pangle_flutter 无法启动,完整错误信息如下:

Launching lib/main.dart on iPhone 13 in debug mode...
Xcode build done.                                           14.6s
Failed to build iOS app
Error output from Xcode build:
↳
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
    { platform:iOS Simulator, id:6DF789CD-1E03-4B77-8F74-E1E992A2F9A6, OS:15.0, name:iPhone 13 }
    { platform:iOS Simulator, id:5DBF6BCF-928C-46AB-99A2-25DCC2ECBAFE, OS:15.0, name:iPhone 13 Pro }
    { platform:iOS Simulator, id:8DEFF211-09F5-4337-B187-0465B09C4ED4, OS:15.0, name:iPhone 13 mini }
    { platform:iOS Simulator, id:5CCE74B8-4ABD-4E3E-9E22-0AC13555BB38, OS:15.0, name:iPhone SE (2nd generation) }
    { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
    ** BUILD FAILED **
Xcode's output:
↳
    /Users/cipchk/.pub-cache/hosted/pub.flutter-io.cn/pangle_flutter-1.4.7/ios/Classes/PangleAdManager.swift:48:28: error: type 'BUAdSDKManager' has no member 'setIsPaidApp'
                BUAdSDKManager.setIsPaidApp(isPaidApp!)
                ~~~~~~~~~~~~~~ ^~~~~~~~~~~~
    /Users/cipchk/.pub-cache/hosted/pub.flutter-io.cn/pangle_flutter-1.4.7/ios/Classes/PangleAdManager.swift:56:42: error: cannot convert value of type 'UInt' to expected argument type 'Int'
                BUAdSDKManager.setCoppa(coppa!)
                                             ^
                                        Int(  )
    /Users/cipchk/Library/Developer/Xcode/DerivedData/Runner-ewjykgsqdascxtdttfmoiryshgtl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/pangle_flutter.build/Objects-normal/x86_64/FLTTaskProtocol.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'pangle_flutter' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/cipchk/.pub-cache/hosted/pub.flutter-io.cn/pangle_flutter-1.4.7/ios/Classes/PangleAdManager.swift:48:28: error: type 'BUAdSDKManager' has no member 'setIsPaidApp'
                BUAdSDKManager.setIsPaidApp(isPaidApp!)
                ~~~~~~~~~~~~~~ ^~~~~~~~~~~~
    /Users/cipchk/.pub-cache/hosted/pub.flutter-io.cn/pangle_flutter-1.4.7/ios/Classes/PangleAdManager.swift:56:42: error: cannot convert value of type 'UInt' to expected argument type 'Int'
                BUAdSDKManager.setCoppa(coppa!)
                                             ^
                                        Int(  )
    /Users/cipchk/.pub-cache/hosted/pub.flutter-io.cn/pangle_flutter-1.4.7/ios/Classes/PangleAdManager.swift:48:28: error: type 'BUAdSDKManager' has no member 'setIsPaidApp'
                BUAdSDKManager.setIsPaidApp(isPaidApp!)
                ~~~~~~~~~~~~~~ ^~~~~~~~~~~~
    /Users/cipchk/.pub-cache/hosted/pub.flutter-io.cn/pangle_flutter-1.4.7/ios/Classes/PangleAdManager.swift:56:42: error: cannot convert value of type 'UInt' to expected argument type 'Int'
                BUAdSDKManager.setCoppa(coppa!)
                                             ^
                                        Int(  )
    /Users/cipchk/Library/Developer/Xcode/DerivedData/Runner-ewjykgsqdascxtdttfmoiryshgtl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/pangle_flutter.build/Objects-normal/arm64/FLTTaskProtocol.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'pangle_flutter' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/cipchk/.pub-cache/hosted/pub.flutter-io.cn/pangle_flutter-1.4.7/ios/Classes/PangleAdManager.swift:48:28: error: type 'BUAdSDKManager' has no member 'setIsPaidApp'
                BUAdSDKManager.setIsPaidApp(isPaidApp!)
                ~~~~~~~~~~~~~~ ^~~~~~~~~~~~
    /Users/cipchk/.pub-cache/hosted/pub.flutter-io.cn/pangle_flutter-1.4.7/ios/Classes/PangleAdManager.swift:56:42: error: cannot convert value of type 'UInt' to expected argument type 'Int'
                BUAdSDKManager.setCoppa(coppa!)
                                             ^
                                        Int(  )
    /Users/cipchk/Desktop/flutter-demo/ios/Pods/libwebp/src/enc/backward_references_enc.c:694:12: warning: variable 'best_offset' may be uninitialized when used here [-Wconditional-uninitialized]
              (best_offset << MAX_LENGTH_BITS) | (uint32_t)best_length;
               ^~~~~~~~~~~
    /Users/cipchk/Desktop/flutter-demo/ios/Pods/libwebp/src/enc/backward_references_enc.c:626:20: note: initialize the variable 'best_offset' to silence this warning
        int best_offset;
                       ^
                        = 0
    1 warning generated.
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel
    /Users/cipchk/Desktop/flutter-demo/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'libwebp' from project 'Pods')
    /Users/cipchk/Desktop/flutter-demo/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'Mantle' from project 'Pods')
    /Users/cipchk/Desktop/flutter-demo/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'FMDB' from project 'Pods')
    /Users/cipchk/Desktop/flutter-demo/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'AlipaySDK-iOS' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)

2.重现步骤

Future testInit() async { await pangle.init( iOS: const IOSConfig(appId: "kAppId"), android: const AndroidConfig(appId: "kAppId"), ); }



**3.期望结果**

**4.SDK版本:**
- Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git
- Framework • revision 18116933e7 (6 weeks ago) • 2021-10-15 10:46:35 -0700
- Engine • revision d3ea636dc5
- Tools • Dart 2.14.4
 - pangle_flutter: 1.4.7
 - iOS: 15.0

**额外信息**
无
nullptrx commented 2 years ago

我想你把错误信息看错了,正确的错误信息是

Could not build the application for the simulator.

忘了从哪个版本开始的,framework默认已经不自带x86架构了。

zeewell commented 2 years ago

@nullptrX 我看有一个错误:

BUAdSDKManager.setIsPaidApp

是不是 @cipchk 用的 iOS SDK 版本比较新?

zeewell commented 2 years ago

@nullptrX 刚看了一下,好像最新版本的 SDK 确实有这个问题(没去看从哪个版本开始的~~)

https://github.com/nullptrX/pangle_flutter/blob/faa3a4b39e235184da7b385bc383e97657689dfb/ios/Classes/PangleAdManager.swift#L39

这个函数的代码需要适配一下。

cipchk commented 2 years ago

我目前使用的是 IOS 15,到现在为此还是无法解决这个问题。

但由于我之前 Fork 过一份 Github 版本(2021-3-8),直接引用这个版本的 git 链接的情况下,在同样的环境里,是可以编译通过。我暂时使用这个版本运行着。

zeewell commented 2 years ago

@cipchk 你 pod 指定一个早一点的 穿山甲 的SDK就可以。或者按我这里说的,在本地改一下代码也能过。

改完后,如果有时间的话,我觉得可以来一个 pull request, @nullptrX 应该会很欢迎哈👏

@nullptrX 刚看了一下,好像最新版本的 SDK 确实有这个问题(没去看从哪个版本开始的~~)

https://github.com/nullptrX/pangle_flutter/blob/faa3a4b39e235184da7b385bc383e97657689dfb/ios/Classes/PangleAdManager.swift#L39

这个函数的代码需要适配一下。

yundGo commented 2 years ago

遇到了同样的问题