admin管理员组文章数量:1384868
I'm adding support for Expo Modules in an existing React Native app. I've been following the "Install Expo modules in an existing React Native project"-guide here, but I run into problems after changes to the iOS project. I'm using expo version 51.0.39
.
I have a swift file in the project, that contains a class that conforms to PKAddPaymentPassViewControllerDelegate
. After adding the expo setup, I'm now seeing an error when I try to build the project. This used to work, until I added the changes from the expo setup guide. I also added #import "ExpoModulesCore-Swift.h"
in AppDelegate.mm
to resolve an issue similar to the one described here. If I simply remove the one protocol conformance to PKAddPaymentPassViewControllerDelegate
it does build successfully.
What can I do to make this build successful?
Mentioned swift class:
class AddPaymentPassHandler: NSObject, PKAddPaymentPassViewControllerDelegate {
// protocol conformance and other good stuff
}
Errors:
- Type argument 'PKAddPaymentPassViewController' must be a pointer (requires a '*')
- Type arguments cannot be applied to non-parameterized class 'NSObject'
- Unknown class name 'PKAddPaymentPassViewControllerDelegate'; did you mean 'PKAddPaymentPassViewController'?
I'm adding support for Expo Modules in an existing React Native app. I've been following the "Install Expo modules in an existing React Native project"-guide here, but I run into problems after changes to the iOS project. I'm using expo version 51.0.39
.
I have a swift file in the project, that contains a class that conforms to PKAddPaymentPassViewControllerDelegate
. After adding the expo setup, I'm now seeing an error when I try to build the project. This used to work, until I added the changes from the expo setup guide. I also added #import "ExpoModulesCore-Swift.h"
in AppDelegate.mm
to resolve an issue similar to the one described here. If I simply remove the one protocol conformance to PKAddPaymentPassViewControllerDelegate
it does build successfully.
What can I do to make this build successful?
Mentioned swift class:
class AddPaymentPassHandler: NSObject, PKAddPaymentPassViewControllerDelegate {
// protocol conformance and other good stuff
}
Errors:
- Type argument 'PKAddPaymentPassViewController' must be a pointer (requires a '*')
- Type arguments cannot be applied to non-parameterized class 'NSObject'
- Unknown class name 'PKAddPaymentPassViewControllerDelegate'; did you mean 'PKAddPaymentPassViewController'?
2 Answers
Reset to default 0I realised that my problem was caused by a faulty header import in AppDelegate.mm
We used to import #import "AppName-Swift.h"
in AppDelegate.mm
probably for legacy reasons. When I removed this import, the above-mentioned error went away and I was able to build successfully. Furthermore, I was able to also remove #import "ExpoModulesCore-Swift.h"
as mentioned above.
Removing headers is not actual solution if you actually use the Appname-Swift.h
header - in such cases you need to find which additional headers to import in order to fix the issue. The solution for current issue can be
#import <PassKit/PassKit>
Found the solution in this thread: https://stackoverflow/a/34397364/1679620
本文标签: iosCan39t build PKAddPaymentPassViewControllerDelegate when setting up Expo ModulesStack Overflow
版权声明:本文标题:ios - Can't build `PKAddPaymentPassViewControllerDelegate` when setting up Expo Modules - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744449110a2606651.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论