We need to create a shared link for a file and then retrieve that link so
that we can display it inside our application.
We are able to create a shared link for a specific file (we can see it
inside Box Account on the Web) but we are not able to retrive sharedLink
via the API. It is always nil, although isShared
method returns YES.
From the header file of BoxObject.h
we find that these two methods provide
required information about shared state of the item.
@protocol BoxObject
// ...
// Information about the shared state of the item
@property (readonly, getter = isShared) BOOL shared;
@property (readonly) NSString *sharedLink;
//...
@end
This is how we create shared link.
- Find BoxFile that we would like to share, lets call that object photo
Prior calling method shareWithPassword:message:emails:callbacks:,
[photo isShared]
returns NO. - we call
[photo shareWithPassword:@"" message:@"" emails:[NSArray arrayWithObject:@""] callbacks:^(id<BoxOperationCallbacks> on1){...}];
- inside on1.after we check if response == BoxCallbackResponseSuccessful and then we call [photo updateWithCallbacks:^(id on2){..}]
- inside on2.after we check if response == BoxCallbackResponseSuccessful
- on successful response
[photo isShared]
returns YES but [photo sharedLink] returns nil
And if we check on the Web, we can see that file is actually shared but we cannot retrive sharedLink from the Box SDK.
Anyone has the same problem?