customerio / customerio-reactnative

MIT License
23 stars 11 forks source link

Unknown type name 'MyAppPushNotificationsHandler' #123

Closed atit closed 1 year ago

atit commented 1 year ago

SDK version: 2.3.2

Describe the issue

I'm creating a react native app, but need to make some adjustments in native iOS code to support push notifications when integrating a CRM system.

I've created a swift file (according to the guide here) that's bridged to Object-C code.

If I add it directly after the "app-Swift.h" I get the error Use of undeclared identifier 'pnHandlerObj' further down in the file where I'm using it.

if I add it just above the didFinishLaunchingWithOptions (below @interface and @implementation AppDelegate) I get two errors Use of undeclared identifier 'MyAppPushNotificationsHandler' and Unknown type name 'MyAppPushNotificationsHandler'. I was correctly importing my Product name and created a swift file MyAppPushNotificationsHandler.swift as per documentation.

Issue similar as -- [Unknown type name 'MyAppPushNotificationHandler']

ami-aman commented 1 year ago

Hi @atit

Apologies for the inconvenience.

The errors Use of undeclared identifier 'MyAppPushNotificationsHandler' and Unknown type name 'MyAppPushNotificationsHandler'. show up when Xcode generated header file is not imported correctly.

In AppDelegate.m or AppDelegate.mm file - you need to import an auto-generated file. As you start typing, Xcode will auto-suggest the file name. Suppose the name of your project is SampleAppFCM, so the file name should be SampleAppFCM-Swift.h and the import statement will look like #import <SampleAppFCM-Swift.h>. If your module name contains spaces for example, `Sample App FCM' then the name of auto-generated file will have an underscore(_) for every space and the import file name will look like '#import '.

Alternatively, you may also check the file name as generated by Xcode in Build Settings -> Objective-C Generated Interface Header Name as shown in the screenshot below.

Screenshot 2023-01-24 at 12 47 38 AM (1)
atit commented 1 year ago

Hi @ami-aman, Thanks for your reply.But I'm still having a issue. I could not find Objective-C Generated Interface Header names in my Build setting general. ( image is attached below) So, for X-code auto-suggesting issue, it's suggesting #import

And I'm importing the same file. Screenshot 2023-04-24 at 15 32 22 Am I missing something, for creating Header Name?
ami-aman commented 1 year ago

@atit

Thank you for your prompt response. Would you be able to share AppDelegate file and a screenshot of your project/module structure i.e the screen on left panel of Xcode showing your app name & structure to win@customer.io ?

atit commented 1 year ago

@ami-aman, I've sent it to win@customer.io.

levibostian commented 1 year ago

Thank you for sending this message to us, @atit. It looks like this particular issue has been resolved and your continued support is being handled through email support.

Have a great day!

3KINGZ commented 7 months ago

@levibostian @ami-aman i'm also facing this issue, i also can't find Objective-C Generated Interface Header in my builds just the Generated Header Name i don't know if they are the same

Screenshot 2024-02-07 at 08 38 31
ami-aman commented 7 months ago

Hi @3KINGZ Objective-C Generated Interface file is auto-generated by Xcode. You won't see the file in your file navigator. The screenshot you shared shows the name of the file generated that you can use to import in your ObjectiveC file to access Swift class.

Does this answer your question? If not, I would appreciate if you could provide it here or open a new ticket with detailed information about the issue.

3KINGZ commented 7 months ago

@ami-aman i meant the key name not the file and yes i also imported the generated header name

ami-aman commented 7 months ago

Gotcha! @3KINGZ The key name has been changed from Objective-C Generated Interface Header Name to Generated Header name in latest Xcode. The functionality remains the same, it is just the key name that has been updated.

3KINGZ commented 7 months ago

@ami-aman alright, but am getting the issue of Unknown type name 'MyAppPushNotificationsHandler'

ami-aman commented 7 months ago

@3KINGZ I would appreciate if you could share detailed information about the issue you are facing along with AppDelegate.m and MyAppPushNotificationsHandler file on win@customer.io. Someone from our team would assist you with the issue.