AppsFlyerSDK / appsflyer-react-native-plugin

AppsFlyer plugin for React Native
MIT License
276 stars 197 forks source link

Build problem with v6 sdk beta #176

Closed michael3chen closed 3 years ago

michael3chen commented 3 years ago

Report

Plugin Version

react native appsflyer - sdk-v6-beta react native - 0.61.5

On what Platform are you having the issue?

iOS

What did you do?

Building xcode project after installing new pods.

What did you expect to happen?

Build to succeed.

What happened instead?

Got 2 errors about missing functions.

Please provide any other relevant information.

Seems like react-native-appsflyer.podspec has a dependency for Beta-AppsFlyerFramework that might be out of sync.

require 'json'
pkg = JSON.parse(File.read("package.json"))

Pod::Spec.new do |s|
  s.name             = pkg["name"]
  s.version          = pkg["version"]
  s.summary          = pkg["description"]
  s.requires_arc     = true
  s.license          = pkg["license"]
  s.homepage         = pkg["homepage"]
  s.author           = pkg["author"]
  s.source           = { :git => pkg["repository"]["url"] }
  s.source_files     = 'ios/**/*.{h,m}'
  s.platform         = :ios, "8.0"
  s.static_framework = true
  s.dependency 'Beta-AppsFlyerFramework', '~> 6.0.1'
  s.dependency 'React'
end
DKolev commented 3 years ago

Hi,

I have the same problem when trying to build my app. Any info on that?

Also, any idea when the final prod ready version will be ready?

af-margot commented 3 years ago

Hi @michael3chen , @DKolev ,

Could you confirm that you run pod install after updating the plugin? If yes, could you try cleaning the project in Xcode? In Xcode, you can check in Pods/Development Pods/react-native-appsflyer/AppsFlyerLib.h if the API are present.

DKolev commented 3 years ago

Hi @af-margot, 10x for the quick response.

So, pod install was done after updating the plugin. To be sure, I just deleted the Pod directory and Podfile.lock and did it again. Also, I did clean the project in XCode but the errors are still present.

In AppsFlyerLib.h I can see logLocationEvent but setDeviceLoggingDisabled is not present.

af-margot commented 3 years ago

Hi @DKolev ,

About the API, you should see deviceLoggingDisabled in AppsFlyerLib.h as it is a property. If you go to Pods/Development Pods/react-native-appsflyer/RNAppsFlyer.m and you clicked on the API(line 399), it should take you to the relevant line in AppsFlyerLib.h

Unfortunately, we are not able to reproduce the issue, as we are not sure what could be the cause here. Could you try the following:

Could you also share the version of Xcode, please ?

DKolev commented 3 years ago

Hello again, I deleted the derived data and -ObjC flag is present. No success. Also, deleted node_modules and did clean npm install & pod install after that.

This happens both on Xcode Version 11.5 (11E608c) & Version 12.0 beta 6 (12A8189n)

Also, when I click on Jump to Definition on line 399 setDeviceLoggingDisabled, I got only a question mark ?, not going anywhere (check the screenshots):

Screenshot 2020-09-01 at 14 06 53 Screenshot 2020-09-01 at 14 08 26
af-margot commented 3 years ago

Hi @DKolev ,

Please open a ticket to support@appsflyer.com, we will take it from there!

michael3chen commented 3 years ago

@af-margot I tried deleting derived data and I do have the -ObjC flag in Other Linker Flags set, but exact same thing as @DKolev is reporting. My xcode version is 11.6

osamaraza24 commented 3 years ago

I'm facing the same two issues In Unity appsflyer - sdk-v6-beta 1 ) 1: Property 'deviceLoggingDisabled' not found on object of type 'AppsFlyerLib *' 2) No visible @interface for 'AppsFlyerLib' declares the selector 'logLocationEvent:latitude:'

Yesterday it was working but It happen after pod update today . because my other plugin require to update pod for download dependencies , any one found solution ? I'm using xcode 12 - beta

ucarbehlul commented 3 years ago

Seems like https://github.com/AppsFlyerSDK/appsflyer-react-native-plugin/blob/dev/sdk-v6-beta/react-native-appsflyer.podspec#L16

has a dependency for Beta-AppsFlyerFramework 6.0.1 version.

cocoa pods downloads this pod and xcode reads AppsFylerLib.h from it instead of Pods/Development Pods/react-native-appsflyer. And as can be seen from https://github.com/AppsFlyerSDK/Beta-AppsFlyerFramework/blob/master/iOS/AppsFlyerLib.framework/Versions/A/Headers/AppsFlyerLib.h#L433 that file does not have the missing methods the compiler complains.

Should we be not using that pod and how should Podfile be in order to do that?

danmelton commented 3 years ago

Confirmed, having the same problem.

It looks like the react-native export methods were renamed, but the calls to the Beta SDK stayed the same.

Patch package diff:

--- a/node_modules/react-native-appsflyer/ios/RNAppsFlyer.m
+++ b/node_modules/react-native-appsflyer/ios/RNAppsFlyer.m
@@ -87,7 +87,7 @@ @implementation RNAppsFlyer
 }

 RCT_EXPORT_METHOD(logLocation: (double)longitude latitude:(double)latitude callback:(RCTResponseSenderBlock)callback) {
-    [[AppsFlyerLib shared] logLocationEvent:longitude latitude:latitude];
+    [[AppsFlyerLib shared] logLocation:longitude latitude:latitude];
     NSArray *events = @[[NSNumber numberWithDouble:longitude], [NSNumber numberWithDouble:latitude]];
     callback(@[SUCCESS, events]);
 }
@@ -396,7 +396,7 @@ -(void) reportOnSuccess:(NSString *)data type:(NSString*) type {
 }

 RCT_EXPORT_METHOD(anonymizeUser: (BOOL *)b callback:(RCTResponseSenderBlock)callback) {
-    [[AppsFlyerLib shared] setDeviceLoggingDisabled:b];
+    [AppsFlyerLib shared].anonymizeUser=b;
     callback(@[SUCCESS]);
 }

Applying above, xcode is building properly

af-margot commented 3 years ago

Hi all,

The current react native AppsFlyer beta version has a dependency on the native sdk beta v6.0.1. This version should contain deviceLoggingDisabled and logLocationEvent. You can check it in Pods/Beta-AppsFlyerFramework/AppsFlyerLib.framework/Headers.AppsFlyerLib.h We are not sure what is causing the issue with this version and we are working on this.

@danmelton , @ucarbehlul , @osamaraza24 , it seems that the AppsFlyer pod was updated to version 6.0.2, which indeed change the names of those API. Could you check that in the Podfile.lock ?

af-margot commented 3 years ago

The react-native plugin will be updated to support 6.0.2, it should solve all issues. @osamaraza24 Unity plugin will be updated as well.

sokoloff06 commented 3 years ago

We have released 6.0.20, please try to use the new version, the issue should be resolved. Thanks!

DKolev commented 3 years ago

Hi @af-vs,

I just tried it and the app builds without any issues.

michael3chen commented 3 years ago

Hi @af-vs,

I just tried it and the app builds without any issues.

works for me too, thanks!

qbit86 commented 3 years ago

The same issue integrating 6.0.2 beta for Unity:

…/AppsFlyeriOSWrapper.mm:60:31: error: property 'deviceLoggingDisabled' not found on object of type 'AppsFlyerLib *'
        [AppsFlyerLib shared].deviceLoggingDisabled = deviceLoggingDisabled;
                              ^
…/AppsFlyeriOSWrapper.mm:92:32: error: no visible @interface for 'AppsFlyerLib' declares the selector 'logLocationEvent:latitude:'
        [[AppsFlyerLib shared] logLocationEvent:longitude latitude:latitude];
         ~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

I don't use pods, I'm following Installation without unity-jar-resolver:

Download the iOS SDK as a static library

https://s3-eu-west-1.amazonaws.com/download.appsflyer.com/ios/AF-iOS-SDK.zip — this archive seems to not contain deviceLoggingDisabled and logLocationEvent:latitude.

@af-vs Where can I download fixed library?

sokoloff06 commented 3 years ago

Hi @qbit86!

Unity plugin is maintained by another developer and I can see there is a relevant thread about the same issue - https://github.com/AppsFlyerSDK/appsflyer-unity-plugin/issues/37

Please note, that due to the last Apple announcement of delaying ATT Authorization pop-up we made a few changes in the SDK and working on releasing v6.0.3 for all plugins, including Unity and I believe this issue will be solved with the next update. CC @wesfieldj

As the problem is solved in the React Native plugin, I am closing the issue. Thank everybody for your feedback and collaboration!