0

I find the dropbox get shared link using the following code. I used this code to get dropbox get shared link using latest api in ios 9 but my problem is that's

My Code in obj c

DBUserClient *client = [DBClientsManager authorizedClient];
            // "Full Dropbox" or "/Apps/<APP_NAME>/" if app has permission "App Folder").

            [[client.sharingRoutes getSharedLinkMetadata:path]setResponseBlock:^(DBSHARINGSharedLinkMetadata * _Nullable result, DBSHARINGSharedLinkError * _Nullable routeError, DBRequestError * _Nullable networkError) {
                if (result) {
                    [self sendEmail:result.url];
                }
                else
                {

                    NSString *title = @"";
                    NSString *message = @"";
                    if (routeError) {
                        // Route-specific request error
                        title = @"Route-specific error";
                        if (routeError ) {
                            message = [NSString stringWithFormat:@"Invalid path: %@", routeError];

                        }

                    }
                    else
                    {
                        // Generic request error
                        title = @"Generic request error";
                        if ([networkError isInternalServerError]) {
                            DBRequestInternalServerError *internalServerError = [networkError asInternalServerError];
                            message = [NSString stringWithFormat:@"%@", internalServerError];

                        }
                        else if ([networkError isBadInputError])
                        {
                            DBRequestBadInputError *badInputError = [networkError asBadInputError];
                            message = [NSString stringWithFormat:@"%@", badInputError];

                        }
                        else if ([networkError isAuthError])
                        {
                            DBRequestAuthError *authError = [networkError asAuthError];
                            message = [NSString stringWithFormat:@"%@", authError];

                        }
                        else if ([networkError isRateLimitError])
                        {
                            DBRequestRateLimitError *rateLimitError = [networkError asRateLimitError];
                            message = [NSString stringWithFormat:@"%@", rateLimitError];

                        }
                        else if ([networkError isHttpError])
                        {
                            DBRequestHttpError *genericHttpError = [networkError asHttpError];
                            message = [NSString stringWithFormat:@"%@", genericHttpError];

                        } else if ([networkError isClientError])
                        {
                            DBRequestClientError *genericLocalError = [networkError asClientError];
                            message = [NSString stringWithFormat:@"%@", genericLocalError];

                        }


                    }

                    UIAlertController *alertController =

                    [UIAlertController alertControllerWithTitle:title
                                                        message:message preferredStyle:(UIAlertControllerStyle)UIAlertControllerStyleAlert];
                    [alertController addAction:[UIAlertAction actionWithTitle:@"OK"
                                                                        style:(UIAlertActionStyle)UIAlertActionStyleCancel
                                                                      handler:nil]];
                    [self presentViewController:alertController animated:YES completion:nil];

                    //[self setFinished];
                }
            }];

and results is results image

but first time i create the link then get its make error plz help me how to get link.... please define me in detail.. thanks

Ali John
  • 9
  • 2
  • What is the value of `path`? It should be an active Dropbox shared link, and if so `getSharedLinkMetadata` will return its metadata. You'll get this `shared_link_not_found` error if the link is not valid. If you want to create a shared link for a particular file path, you should use [`createSharedLinkWithSettings`](https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBSHARINGUserAuthRoutes.html#/c:objc(cs)DBSHARINGUserAuthRoutes(im)createSharedLinkWithSettings:) instead. – Greg Mar 29 '18 at 14:43
  • i having path of main routes like path == /abc.png and return routes error like `shared_link_not_found`....when i am going to web dropbox its showing shared link according to my above code – Ali John Mar 30 '18 at 12:51
  • A value like `"/abc.png"` is a file path, not a shared link, so this error is expected in this case. You should instead use [`createSharedLinkWithSettings`](https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBSHARINGUserAuthRoutes.html#/c:objc(cs)DBSHARINGUserAuthRoutes(im)createSharedLinkWithSettings:) to create a shared link for that path, or [`listSharedLinks`](https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBSHARINGUserAuthRoutes.html#/c:objc(cs)DBSHARINGUserAuthRoutes(im)listSharedLinks) to retrieve it if it already exists. – Greg Mar 30 '18 at 15:11

0 Answers0