Posts tagged with ios

I'm developing SDK for Facebook(meta) and use FBSDKGraphRequest to get some data. As the demand of access-token, I want to test the case that access-token has been invalid(mostly out of time), so I generate a short term token from fb's graph developer and wait for 2 hours until it invalid. Then I build an out-of-date token and FBSDKGraphRequest. Use FBSDKGraphRequest but nothing back(no result, no error).

I generate a short term token from fb's graph developer and wait for 2 hours until it invalid.

Use these code :

FBSDKAccessToken *access_token = [[FBSDKAccessToken alloc] initWithTokenString: @"xxxxxx"(tokenString from graph developer)                                                                        permissions:@[@"public_profile",@"email", @"user_friends"]                                                                declinedPermissions:nil                                                                 expiredPermissions:nil                                                                              appID:@"xxxxxx" (my appid)                                                                             userID:@"xxxxxx"(myuserid)                                                                     expirationDate:[NSDate dateWithTimeIntervalSince1970:1717041600]                                                                        refreshDate:[NSDate dateWithTimeIntervalSince1970:1717041500]                                                           dataAccessExpirationDate:nil];     [FBSDKAccessToken setCurrentAccessToken:access_token]; 

I generate a FBSDKAccessToken which generated by out-date tokenString and test in these code :

            FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]                                           initWithGraphPath:@"/me"                                           parameters:@{ @"fields": @"picture",}                                           HTTPMethod:@"GET"];             [request startWithCompletion:^(id<FBSDKGraphRequestConnecting>  _Nullable connection, id  _Nullable result, NSError * _Nullable error) {                 NSLog(@"request back!");                 NSLog(@"fb has error:%@", error.description);                 //get picture url             }]; 

When the token is valid(not out of date), it works and has log. But when it is invalid(out of date) , there is no log(no result no error, even no "request back!".

After long time debug and searching answer on Google, I don't find similar reason. But I find FBSDKAccessToken have a func "refreshCurrentAccessTokenWithCompletion" can also get the status of the token. So I used this to judge the token's status before FBSDKGraphRequest. But something magical happened. After I add refreshCurrentAccessTokenWithCompletion, FBSDKGraphRequest works too. It shows log "request back!".

This might be a way to solve this problem. But I think there must be a method to solve this better and some root cause.

We have been using Facebook login in our app since forever and this has always worked well.

We have upgraded to the SDK v.17 and have changed the code to use limited login into our app. When we open the Facebook login screen, we are always getting this warning:

"If you are not using Limited Login, you will need to handle all Graph API calls using Graph API, iOS. The access token will not be valid. To learn more about changes to the Facebook SDK for iOS and how you can continue using the Facebook Login SDK, visit the blog."

This is strange, because as you can see in the screenshot it does go to limited.facebook.com...

We have implemented it as per the documentation, here is a code snippet with the relevant lines of code:

     let facebookManager = LoginManager()  guard let configuration = LoginConfiguration(permissions: ["email", "public_profile"], tracking: .limited, nonce: UUID().uuidString) else {     return }         facebookManager.logIn(configuration: configuration) { [self] result in     switch result {     case .cancelled:            // throw cancelled     case .failed:            // throw failed     case .success:         if let token = AuthenticationToken.current?.tokenString {            // send token to server         } else {            // throw no token error         }     } } 

Why do we get the warning on the Facebook Login page? Other than the above, is there anything else weI need to change to use limited login? What are we missing here? Also the token we get back doesn't seem to be valid (yet to be confirmed).

I am getting this error and my code is below

 - (void)viewWillAppear:(BOOL)animated {       NSLog(@"self.inter eve reload cl %@", self.interstitial);       DebugAssert(index != NSNotFound);       double delayInSeconds = 5.0;       dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));            if (!didPurchaseAds) {                 dispatch_after(popTime, dispatch_get_main_queue(), ^(void){                 NSLog(@"Interstitial ad loaded %ld", (long)index);                     if ((index % 2 == 0)) {                          NSLog(@"Interstitial ad loaded for even num %ld", (long)index);                             if (self.interstitial) {                                 NSLog(@"Show InterstitialAd %@", self.interstitial);                                 [self.interstitial presentFromRootViewController:self];                                 [self.interstitial presentFromRootViewController:self];                               } else {                                 NSLog(@"Ad wasn't ready event");                            }                         }                   });           }     }          - (void)viewDidLoad{        [super viewDidLoad];         [self loadInterstitial];     }          - (void)loadInterstitial {             GADRequest *request = [GADRequest request];             [GADInterstitialAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910"                                         request:request                               completionHandler:^(GADInterstitialAd *ad, NSError *error) {                 if (error) {                     NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]);                     return;                 }                 self.interstitial = ad;                 self.interstitial.fullScreenContentDelegate = self;             }];         }               - (void)ad:(nonnull id<GADFullScreenPresentingAd>)ad     didFailToPresentFullScreenContentWithError:(nonnull NSError *)error {         NSLog(@"Ad did fail to present full screen content.");     }          /// Tells the delegate that the ad will present full screen content.     - (void)adWillPresentFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)ad {         NSLog(@"Ad will present full screen content.");     }          /// Tells the delegate that the ad dismissed full screen content.     - (void)adDidDismissFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)ad {        NSLog(@"Ad did dismiss full screen content.");     }           

I am running google ads campaign for IOS application , I have implemented firebase analytics in our application ,I have created an event in analytics and imported these events like first_open , screen_view on ads also , I have done all things which is require for ads still I am not getting downloads , In 4 to 5 days we got 444 Impressions , 9 Clicks and 0 install. It is Working fine for android app campaign but it is not working for IOS app campaign. Is there any code issue or we are doing something wrong while running campaign , guys please help me out with this issue.

I am using Google Ads to promote my app. I have integrated Firebase, and in Google Ads I can see how many conversions brought through Google Ads.

My question is, can it be identified by code in the app, whether the current installation is downloaded by clicking Google Ads.

If a user now sees the advertisement and clicks on it, he will be directed to the App Store via the Google Analytics link "click.google-analytics....redirect=... ". Afterwards I would like to see in the AppDelegate if it comes over such a link. Can I take this from the URL, for example? Or is that not possible because it is routed through the App Store?

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {     // Get CampaignName or some identifier from the Google Ad     return true }