GithubHelp home page GithubHelp logo

box / box-ios-sdk Goto Github PK

View Code? Open in Web Editor NEW
121.0 121.0 110.0 231.78 MB

iOS SDK for the Box Content API

Home Page: https://developer.box.com

License: Apache License 2.0

Ruby 0.69% Swift 99.15% Objective-C 0.02% Shell 0.13%
box sdk swift

box-ios-sdk's People

Contributors

achunbox avatar adempsey avatar adempseybox avatar antusus avatar arjankowski avatar box-sdk-build avatar bsuvorov avatar cburnette avatar crousselle avatar danielcech avatar dependabot[bot] avatar digitalsolomon avatar irvingruan avatar jdizoglio avatar jeff-meadows avatar jlawton avatar jpang1 avatar mashfiquea avatar mattkiazyk avatar mgrytsai avatar mhagmajer avatar pjsimon avatar potrebic avatar prithvijutur avatar rlee0731 avatar scottliubox avatar sowmiya avatar sujaygarlanka avatar swfree avatar thuybox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

box-ios-sdk's Issues

Framework not found BoxContentSDK

Hello there, I am trying to link the Box SDK into a project that I am currently working on.
I followed your instruction and tried to add the SDK after I did 'Pod Install'
However, I am still getting a Framework not found issue, any idea of how to proceed forward?

I have tried to modify 'Framework search Paths' , adding the folder to 'Linked Frameworks and Libraries' and adjusting 'Copy Bundle Resources' but still no luck

screen shot 2016-12-09 at 11 54 20 am

Could you please provide a more detailed instruction of how to set up the SDK with an existing App? Thank you

Unable to retrieve tags through iOS SDK

Tags seem to be an integral part of identifying certain folders and files or creating groups of content. I'm building an app for a client where they would like to utilize tags to identify certain things, but so far I've been unable to determine how to acquires tags on BOXFolder or BOXFile objects.
Here's how I'm making a request for folders contents:

    BOXFolderItemsRequest *itemsRequest = [self.client folderItemsRequestWithID:self.folderID];
    itemsRequest.requestAllItemFields = YES;
    [itemsRequest performRequestWithCompletion:^(NSArray *items, NSError *error) {
        if (error == nil) {
            self.items = items;
            [self.carouselView reloadData];
        }
    }];

I assumed that by setting the itemsRequest.requestAllItemsFields = YES that I would get all fields. But from what I can see, tags is not a property on any of the model objects BOXModel, BOXItem, BOXFolder, BOXFile. I also checked the JSON field and the tags field is not in their either. Should the tags be included as a first class citizen and have a property? Or at a minimum included with the JSON data?

This post eluded that a bug should be filed. I don't see that one was so am filing one just in case.

Thanks
Jordan

Does this library support Single Sign On across multiple apps using this library?

Hello there, we have a couple in-house iOS apps already using the Box SDK. We’re trying to use it with a new in-house iOS app, and had a question.

  • Does the Box iOS SDK implement SSO feature? i.e. if two app on the same iOS device uses Box API authentication, then user logged into one app will not require logging into the second app. The second app will fetch the user logged in session/ information from the first app.

fetchAccessTokenWithCompletion loop

Hi there!,

I'm trying to authenticate using access token fetched from my backend, using the following:

- (void)fetchAccessTokenWithCompletion:(void (^)(NSString *, NSDate *, NSError *))completion

Everything goes ok if I'm able to get the token but if for some reason I get an error, connection issues or anything then I will try to call the completion block with error something like:

completion(nil, nil, [[NSError alloc] initWithDomain:@"" code:40000 userInfo:nil]);

The problem is that I enter in a loop, the controller BOXFolderViewController will try to get the token over and over again for ever, how can I stop the BOXContentClient to ask indefinitely for the token?

Crash updating from v2 when keychain credentials not found

We have an app that used the old, deprecated iOS SDK, which was updated to the new one. After the update, the app has a record of the Box account, but Box appears to track this itself in a keychain item, which it doesn't find. This leads to an exception during the first box operation:

-[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x18e3341c0 __exceptionPreprocess + 124
1  libobjc.A.dylib                0x18cd6c55c objc_exception_throw + 56
2  CoreFoundation                 0x18e218c3c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 364
3  CoreFoundation                 0x18e218aac +[NSDictionary dictionaryWithObjects:forKeys:count:] + 64
4  Apex Apps                      0x1000add70 -[BOXAbstractSession keychainDictionary] (BOXAbstractSession.m:269)
5  Apex Apps                      0x1000f762c -[BOXOAuth2Session keychainDictionary] (BOXOAuth2Session.m:314)
6  Apex Apps                      0x1000acd80 -[BOXAbstractSession storeCredentialsToKeychain] (BOXAbstractSession.m:146)
7  Apex Apps                      0x1000f6e90 __65-[BOXOAuth2Session performRefreshTokenGrant:withCompletion

I didn't find anything in the documentation addressing migrating from the old SDK to the new one, so it's possible we're doing something broken.

Any idea what's going on?

Integrate SDK Manually

Hi,
Can you please provide instructions to integrate the SDK manually? I do not have admin rights in my mac (to install ruby, cocoapods etc)

Retain Cycles

We have some retain cycles in some of our requests.

We need to figure out how to break them when the requests complete.

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Problem deleting current dictionary.' into ios

Hi guys.

I have crash into lib when run my app on simulator with iOS 10 after auth into box

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Problem deleting current dictionary.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010bda534b exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010b80621e objc_exception_throw + 48
2 CoreFoundation 0x000000010bda9442 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010b39cedd -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 My Project 0x000000010716473b -[BOXKeychainItemWrapper resetKeychainItem] + 427
5 My Project 0x00000001070f04cc -[BOXAbstractSession storeCredentialsToKeychain] + 364
6 My Project 0x0000000107171826 __85-[BOXOAuth2Session performAuthorizationCodeGrantWithReceivedURL:withCompletionBlock:]_block_invoke_2 + 358
7 My Project 0x0000000107188290 __47-[BOXUserRequest performRequestWithCompletion:]_block_invoke_2 + 48
8 My Project 0x00000001071336e3 +[BOXDispatchHelper callCompletionBlock:onMainThread:] + 195
9 My Project 0x00000001071881ef __47-[BOXUserRequest performRequestWithCompletion:]_block_invoke + 511
10 My Project 0x00000001070f6ba6 -[BOXAPIJSONOperation performCompletionCallback] + 310
11 My Project 0x00000001070ff38f -[BOXAPIOperation finish] + 143
12 My Project 0x00000001070fff30 -[BOXAPIOperation connectionDidFinishLoading:] + 128
13 CFNetwork 0x0000000107ce5dd8 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 72
14 CFNetwork 0x0000000107ce5cea -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 199
15 CFNetwork 0x0000000107ce5c11 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 48
16 CFNetwork 0x0000000107cea1b6 ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 104
17 CFNetwork 0x0000000107f09cd5 ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 100
18 libdispatch.dylib 0x000000010c5ea0cd _dispatch_client_callout + 8
19 libdispatch.dylib 0x000000010c5c49f7 _dispatch_block_invoke_direct + 567
20 CFNetwork 0x0000000107ce5adc _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 24
21 CoreFoundation 0x000000010bcf6014 CFArrayApplyFunction + 68
22 CFNetwork 0x0000000107ce59d5 _ZN19RunloopBlockContext7performEv + 137
23 CFNetwork 0x0000000107ce586e _ZN17MultiplexerSource7performEv + 282
24 CFNetwork 0x0000000107ce5690 _ZN17MultiplexerSource8_performEPv + 72
25 CoreFoundation 0x000000010bd4a311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
+ 17
26 CoreFoundation 0x000000010bd2f59c CFRunLoopDoSources0 + 556
27 CoreFoundation 0x000000010bd2ea86 __CFRunLoopRun + 918
28 CoreFoundation 0x000000010bd2e494 CFRunLoopRunSpecific + 420
29 Foundation 0x000000010b2e9080 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
30 Foundation 0x000000010b2e8f5b -[NSRunLoop(NSRunLoop) run] + 76
31 My Project 0x00000001070fe799 +[BOXAPIOperation globalAPIOperationNetworkThreadEntryPoint:] + 105
32 Foundation 0x000000010b2f8f74 __NSThread__start
+ 1243
33 libsystem_pthread.dylib 0x000000010c99399d _pthread_body + 131
34 libsystem_pthread.dylib 0x000000010c99391a _pthread_body + 0
35 libsystem_pthread.dylib 0x000000010c991351 thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

2016-08-18_1035

can not change redirectURI and nonce to custome variables

The box-ios-sdk only work when I create a new Box application with empty redirectURI, with current box app with an existing redirectURI, there is no way to get it work.

Also, is there anyway to get box credentialSecret and credentialToken returned after I logged in ? I need these values to perform Meteor login using Box Account.

Thanks.

Crash in BOXKeychainItemWrapper.m

App crashes suddenly once in a while in method
resetKeychainItem
at line 210:
NSAssert( junk == noErr || junk == errSecItemNotFound, @"Problem deleting current dictionary." );
Is there any way to avoid this crash/Any update on this issue

Search request + performRequestWithCompletion SIGABRT crash

Hey,

I'm trying to implement search functionality using Box SDK. Using Swift 1.2 with Xcode 6.4.

 func search(keyword:String) {
        var searchRequest = client.searchRequestWithQuery(keyword, inRange: NSRange(location: 0, length: 1000))

        searchRequest.performRequestWithCompletion { (items:[AnyObject]!, totalCount:UInt, range:NSRange, error:NSError!) -> Void in
          // handle processing result here.
        }
}

Unfortunately I'm getting a SIGABRT in BOXAPIOperation.globalAPIOperationNetworkThreadEntryPoint (screenshot below)

screen shot 2015-09-14 at 2 32 04 pm

With the following error :

015-09-14 14:18:47.782 BoxTestApplication[52331:56352142] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010c54cc65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010b8d0bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010c4198ca -[__NSArrayM insertObject:atIndex:] + 954
    3   BoxTestApplication                      0x0000000107187391 __49-[BOXSearchRequest performRequestWithCompletion:]_block_invoke + 961
    4   BoxTestApplication                      0x000000010710df8a -[BOXAPIJSONOperation performCompletionCallback] + 314
    5   BoxTestApplication                      0x00000001071164ef -[BOXAPIOperation finish] + 143
    6   BoxTestApplication                      0x0000000107117080 -[BOXAPIOperation connectionDidFinishLoading:] + 128
    7   CFNetwork                           0x000000010c153d6c __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 69
    8   CFNetwork                           0x000000010c153d10 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 199
    9   CFNetwork                           0x000000010c153e77 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 48
    10  CFNetwork                           0x000000010c023347 ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 107
    11  CFNetwork                           0x000000010c0f0a71 ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 273
    12  CFNetwork                           0x000000010c00e5d6 _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 72
    13  CoreFoundation                      0x000000010c453354 CFArrayApplyFunction + 68
    14  CFNetwork                           0x000000010c00e497 _ZN19RunloopBlockContext7performEv + 133
    15  CFNetwork                           0x000000010c00e2d6 _ZN17MultiplexerSource7performEv + 256
    16  CFNetwork                           0x000000010c00e0ec _ZN17MultiplexerSource8_performEPv + 72
    17  CoreFoundation                      0x000000010c480431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    18  CoreFoundation                      0x000000010c4762fd __CFRunLoopDoSources0 + 269
    19  CoreFoundation                      0x000000010c475934 __CFRunLoopRun + 868
    20  CoreFoundation                      0x000000010c475366 CFRunLoopRunSpecific + 470
    21  Foundation                          0x0000000108eeef92 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 275
    22  Foundation                          0x0000000108f7a080 -[NSRunLoop(NSRunLoop) run] + 74
    23  BoxTestApplication                      0x0000000107115939 +[BOXAPIOperation globalAPIOperationNetworkThreadEntryPoint:] + 105
    24  Foundation                          0x0000000108eed09d __NSThread__main__ + 1194
    25  libsystem_pthread.dylib             0x000000010d60e268 _pthread_body + 131
    26  libsystem_pthread.dylib             0x000000010d60e1e5 _pthread_body + 0
    27  libsystem_pthread.dylib             0x000000010d60c41d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Is it a BoxSDK issue or am I doing something incorrectly?

Is this app runnable

i downloaded this application and tried to run the app in IOS but its not running..can some one please help me to run this application and how to integrate with our box application

How to use box SDK through our own backend

It is not safe to store authentication information in the mobile app.

We already access box.net through our own backend. So, our mobile app call our own URL, which calls box.net with authentication information and it shows in a web view. Everything works fine.

Now we want to use box sdk because it is much nicer. However, how do we use the sdk with our own URL instead of box authentication?

authenticateWithCompletionBlock:cancelBlock: not callable

Tried to follow instructions here : https://github.com/box/box-ios-sdk/blob/master/doc/Authentication.md

Found this:

screen shot 2016-01-09 at 2 25 56 pm

It looks like the cancel block part of this method is not recognized. I took out the cancel block and it worked ok but It would be nice to register user cancels of the auth process.

I tried the second option of presenting the my own viewcontroller for authentication, but then the cancel button did not appear.

This process causes a login prompt to appear with no cancel button at all.

screen shot 2016-01-09 at 2 53 58 pm

It seems like there is an issue withe the cancel for authentication.

Note: I even compiled the sample code all and looked for the test of the authenticateWithCompletionBlock and found that it doesn't recognize cancelBlock there either:

screen shot 2016-01-09 at 3 15 50 pm

I ended up adding my own cancel button to box's auth controller.

Memory leaks from requests causing completionBlock to be retained indefinitely

Hi,

I am using this SDK for a mobile app project. However, after performing some requests, captured objects from my completion blocks don't seem to get released. Digging into the SDK's source code, I found out a couple of retain cycles. Most of them retain strong self in the success handlers. One of them doesn't set a recursive __block block to be nil after use. Please refer to a dirty fix commit below for the troubling lines

vinceplusplus@6453133

Thanks

Downloadable links can't be generated with new sdk

I am using following code to create a shareable link to download files for others

BOXContentClient *contentClient = [BOXContentClient defaultClient];
BOXFileShareRequest *request = [contentClient sharedLinkCreateRequestForFileWithID:path];
[request setCanDownload:YES];
[request setCanPreview:YES];

[request performRequestWithCompletion:^(BOXFile *file, NSError *error)
{
    if(error != nil)
    {
        [self.mainController.indicator hide];
        [Utilities errorDisplay:error.localizedDescription];
    }
    else
    {
        if (self.shouldDownload)
        {
            [self downloadFileWithPath:file.sharedLink.downloadURL.absoluteString name:self.filename];
        }
        else
        {
            [self.mainController openSharingDialog:file.sharedLink.downloadURL.absoluteString];
        }
    }
}];

As can be seen setDownload is Yes

however when link is opened it gives error access denied.

How can i create downloadable link?

BOX SDK - JWT / App User - Hangs on authentication

I have an issue that keeps propping up on a iOS app that I inherited. It is using the token from the backed API and passing it back to the app. Checking the token in a test app they are valid.

When the token is passed back through the completion method in the fetchAccessTokenWithCompletion method the SDK appears to accept the token and send a request to /2.0/users/me; however, that API call never appears to send.

When hooked up to a debugging proxy (Fiddler) it does not show in the output. Tracing through the code I am not sure that the SDK is even sending the call to me.

Output log (with the BOX debug log enabled)

splitViewController viewControllers at index 1 at load attachment click<UINavigationController: 0x133123000>
-[BOXParallelAPIQueueManager enqueueOperation:]: enqueued <BOXAPIAppUsersAuthOperation: 0x17410bd90> GET (null) on global queue
__50+[BOXAPIOperation globalAPIOperationNetworkThread]_block_invoke: <NSThread: 0x170663d00>{number = 7, name = Box API Operation Thread} started
2017-01-20 08:37:06.821329 IAFLMo<AppNameHere>bile[4219:2617290] Box Session {
    AuthVersion = 1;
    "access_token" = <tokenGoesHere>;
    "expires_in" = 3600;
    "refresh_token" = "<null>";
    "restricted_to" = "<null>";
    "token_type" = bearer;
}
-[BOXParallelAPIQueueManager enqueueOperation:]: enqueued <BOXAPIJSONOperation: 0x1701119d0> GET https://api.box.com/2.0/users/me on global queue
-[BOXAPIQueueManager AuthOperationDidComplete:]: <BOXAPIAppUsersAuthOperation: 0x17410bd90> GET (null) completed. Removing from set of Auth dependencies
-[BOXAPIAppUsersAuthOperation finish]: BOXAPIOperation <BOXAPIAppUsersAuthOperation: 0x17410bd90> GET (null) finished with state 3
-[BOXAPIOperation executeOperation]: BOXAPIOperation <BOXAPIJSONOperation: 0x1701119d0> GET https://api.box.com/2.0/users/me was started
-[BOXAPIOperation executeOperation]: Starting <BOXAPIJSONOperation: 0x1701119d0> GET https://api.box.com/2.0/users/me

Reset the app login credentials.

-(void)authenticationRequest:(void (^)(BOXUser *user, BOXContentClient *client, NSError *error))completionHandler{
	self.appClient = nil;
	[BOXContentClient logOutAll];
	
	self.client = [BOXContentClient clientForNewSession];
	[self.client  setAccessTokenDelegate:self];
	[self.client  authenticateWithCompletionBlock:^(BOXUser *user, NSError *error) {
		if (error) {
			if ([error.domain isEqualToString:BOXContentSDKErrorDomain] && error.code == BOXContentSDKAPIUserCancelledError) {
				BOXLog(@"Authentication was cancelled, please try again.");
			} else {
				UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil
																	message:@"Login failed, please try again"
																   delegate:nil
														  cancelButtonTitle:nil
														  otherButtonTitles:@"OK", nil];
				[alertView show];
			}
		} else {
			self.curUser = user;
			self.appClient = [BOXContentClient clientForUser:user];
			[self.appClient  setAccessTokenDelegate:self];
			
			completionHandler(self.curUser, self.appClient , error);
		}
	}];
}

fetchAccessTokenWithCompletion

-(void)fetchAccessTokenWithCompletion:(void (^)(NSString *, NSDate*, NSError *))completion{
    
    Client *selectedClient=[SessionStore sharedManager].selectedClient;
    
    WRHTTPClient *connectionClient = [WRHTTPClient sharedClient];
    
    [connectionClient.requestSerializer setValue:[@(selectedClient.Id) stringValue] forHTTPHeaderField:KClientheader];
    [connectionClient GET:[WRURLManager getDocumentBoxSession] parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable JSON) {
        NSHTTPURLResponse *httpResponse=(NSHTTPURLResponse *) task.response;
        NSLog(@"Box Session %@",JSON);
        if(httpResponse.statusCode==HTTP_STATUS_SUCCESS)
        {
            self.accessToken = [JSON valueForKey:@"access_token"];           
            completion(self.accessToken, 3600, nil);
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
    }];
}

App to app login problem

I try to integrate app to app login.

  1. Add to info.plist LSApplicationQueriesSchemes with "box-onecloud"
  2. Add URL Schemes with "boxsdk-MY_CLIENT_ID"
  3. Call [ BOXContentClient setAppToAppBoxAuthenticationEnabled:YES ]; before auth.

After redirect to box app, it show black controller with cancel button. What I'm doing wrong?

Assert in BOXContentClient init crashing unintentionally if clientID and client secret not set

Hi,

I am getting a crash in [[BOXContentClient defaultClient] logOut] and traced it to the singleton not haven't been initialized yet (BOXContentClient init crashes from the Assert for clientID and client secret not set). I know the Assert here is well intentioned, however there is a case where calling logout before it is initialized that I believe should be accounted for.

Because the BOX SDK supplements most apps as an additional way to import user data, I don't believe it is the primary path of usage. Therefore, the initialization of the BOX singleton should be left until users actually choose to import from BOX in their usage session. This is consistent with the documentation you guys provide, calling setClientID:clientSecret: right before actually use the SDK. In this scenario, the BOX singleton may not always be initialized yet, cause the Assert crash if logout is called.

I suggest that there should be a way to call logout on BOX that's essentially a no-op, for the case that the user hasn't navigated to using the BOX SDK in the host app (BOX singleton not initialized yet or clientID/secret not set yet).

Update:
I noticed setClientID:clientSecret: doesn't actually initialize the singleton but just sets static IDs, so maybe the readme should be explicit that it must be called on app initialization instead.

Thanks.

Enums in Swift

Using typedef enum to define enum is not correctly translated to Swift by the compiler. You should use the NS_ENUM macro for this.

Pod install on BoxContentSDKSampleApp doesn't work

When doing pod install on the sample app, the following error is obtained.

Analyzing dependencies
Fetching podspec for box-ios-sdk from ../
[!] Unable to satisfy the following requirements:

  • box-ios-sdk (from ../) required by Podfile
  • box-ios-sdk required by Podfile.lock

Specs satisfying the box-ios-sdk (from ../), box-ios-sdk dependency were found, but they required a higher minimum deployment target.

Lock Thread in BoxFileSystem.m after call - (void)refreshAccessTokenIfNeeded.

Box sdk version - 1.0.11

When I call - (void)performRefreshTokenGrant:(NSString *)expiredAccessToken withCompletionBlock:(void(^)(BOXOAuth2Session *session, NSError *error))block in BOXOAuth2Session the completitionBlock doesn't be call see:

[super performRefreshTokenGrant:expiredAccessToken withCompletionBlock:^(BOXAbstractSession *session, NSError *error) {
            if (expiredAccessToken.length > 0 && error != nil && ![self isInvalidGrantError:error]) {
                [self.expiredOAuth2Tokens removeObject:expiredAccessToken];
            }
        }];

For hotFix I insert call completitionBlock. :

[super performRefreshTokenGrant:expiredAccessToken withCompletionBlock:^(BOXAbstractSession *session, NSError *error) {
            if (expiredAccessToken.length > 0 && error != nil && ![self isInvalidGrantError:error]) {
                [self.expiredOAuth2Tokens removeObject:expiredAccessToken];
            }
            block(nil,nil);
        }];

May be we have another way to fix this problem?

Show images on our own view controller using this sdk-ios

hi jdizoglio,

first of all thanks to your team for developing this box ios sdk..
we are integrating this ask into our swift project.we can login using this app and we have to show the images which are in the box.com on our own view controller. we are trying this. can you please help us on this.do we need any token or credentials to achieve that

What to put for Scope when calling metadataTemplateInfoRequestWithScope ?

Hello there

I have look through the documentation but I wasn't able to find the info I want.
Specifically, I would like to call this function.

BOXMetadataTemplateRequest *metadataTemplateRequest = [contentClient metadataTemplateInfoRequestWithScope:@"your_scope" template:@"your_template"];

However, I do not know what to put for "your_scope", and I couldn't find any documentations.
If anyone know where to look, please let me know!~

Cheers

Missing requestAllFile/FolderFields for some requests

Hi,

It seems that some requests returning BOXFile/BOXFolder instances do not have a request-all-fields field. Some of them do return complete information and some of them don't. This makes it a bit inconsistent

BOXFolderCreateRequest
BOXFileUploadRequest
BOXFileUploadNewVersionRequest
BOXFolderCopyRequest
BOXFileCopyRequest

Thanks

Redirect URI mismatch when running sample app

When running the sample app, I get a redirect_uri mismatch after attempting to login:

Screenshot of redirect_uri error

I found some documentation in BOXOAuth2Session.h that says I must leave the redirect_uri in my app settings blank. However, this is impossible if you've had a redirect URI previously set. Attempting to clear my app's redirect URI in Box gives the error - "OAuth2 redirect URL must specify a valid URL and must not be http://".

Perhaps adding some extra documentation in the sample app indicating what the redirect_uri should be would help.

Pod Install gives "NoMethodError - undefined method `files' for #"

Hello there

I am trying to add the SDK to an existing project.
I realized that whenever I tried to do pod install, cocoapods is giving me a no method error, I tried many different solutions and still no luck :( Help would be appreciated!

Analyzing dependencies
Downloading dependencies
Using box-ios-sdk (1.0.14)
Generating Pods project
Integrating client project

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

### Command

/Users/Davix/.rbenv/versions/2.0.0-p353/bin/pod install


### Report

* What did you do?

* What did you expect to happen?

* What happened instead?


### Stack

CocoaPods : 1.2.0.beta.1
Ruby : ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin15.3.0]
RubyGems : 2.6.4
Host : Mac OS X 10.12.1 (16B2555)
Xcode : 8.1 (8B62)
Git : git version 2.9.3 (Apple Git-75)
Ruby lib dir : /Users/Davix/.rbenv/versions/2.0.0-p353/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ ae978c13bb3dfeeb0ad9ffd3347b375073c61976


### Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.1.1
cocoapods-try : 1.1.0


### Podfile

```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
workspace 'MyWorkspace'

target 'IBMCaptureSDK-Sample' do
pod 'box-ios-sdk'
end

Error

NoMethodError - undefined method `files' for #<Xcodeproj::Project::Object::PBXFileReference:0x007fe66b84bb20>
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer/user_project_integrator/target_integrator.rb:93:in `block in add_pods_library'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer/user_project_integrator/target_integrator.rb:88:in `each'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer/user_project_integrator/target_integrator.rb:88:in `add_pods_library'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer/user_project_integrator/target_integrator.rb:60:in `block in integrate!'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer/user_project_integrator/target_integrator.rb:57:in `integrate!'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer/user_project_integrator.rb:129:in `each'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer/user_project_integrator.rb:129:in `integrate_user_targets'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer/user_project_integrator.rb:63:in `integrate!'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer.rb:612:in `block in integrate_user_project'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer.rb:609:in `integrate_user_project'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/installer.rb:117:in `install!'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/command/install.rb:37:in `run'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/lib/cocoapods/command.rb:50:in `run'
/Users/Davix/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/cocoapods-1.2.0.beta.1/bin/pod:55:in `<top (required)>'
/Users/Davix/.rbenv/versions/2.0.0-p353/bin/pod:22:in `load'
/Users/Davix/.rbenv/versions/2.0.0-p353/bin/pod:22:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Running BoxContentSDKSampleApp in Xcode 7 with Swift gives errors ...

Hi,

I am looking to leverage the sample app for a Swift project and followed the instructions for creating a podfile for the BoxContentSDKSampleApp. Later, I updated the code in AppDelegate.m into AppDelegate.swift and added all the user created/UI related .h files in the objective C bridging header. However, I run into a series of a cascading set of issues primarily around header files not being invoked in the .m files.

Looking for inputs on how to get the BoxContentSDKSampleApp code working in Swift.

Thanks in advance.

Podfile syntax changed for latest version of Cocoapods

It looks like 'pod install' no longer works unless you specify a target app in the Podfile...

So for example from the Podfile that comes with BoxContentSDKSampleApp:

pod 'box-ios-sdk', :path => '../' #no longer works

instead do this

target "BoxContentSDKSampleApp" do
pod 'box-ios-sdk', :path => '../'
end

Syntax error in the example

Get the items in a Box Folder

BOXContentClient *contentClient = [BOXContentClient defaultClient];

BOXFoderItemsRequest

*folderItemsRequest = [contentClient folderItemsRequestWithID:@"folder-id"];
[folderItemsRequest performRequestWithCompletion:^(NSArray *items, NSError *error) {
// If successful, items will be non-nil and contain the list of items; otherwise, error will be non-nil.
}];

"parent of node to add does not exist" when trying to update metadata

Hey All

I am trying to update the metadata of a file

This is the error I am getting

"parent of node to add does not exist"

This is my code

    func updateMetaData(fileID : String, completionBlock : BOXMetadataBlock){
        
        let client = BOXContentClient.defaultClient()
        let task : BOXMetadataUpdateTask = BOXMetadataUpdateTask.init(operation: BOXMetadataUpdateADD, path: "/checked", value: "true")
        let request : BOXMetadataUpdateRequest = client.metadataUpdateRequestWithFileID(fileID, template: "poddemo", updateTasks: [task])
        request.performRequestWithCompletion(completionBlock)
        
    }

--EDIT

How I create the MetaData On File

func createMetadataOnFile(fileID : String, completionBlock : BOXMetadataBlock){

        let client = BOXContentClient.defaultClient()
        var task = []
        let metaDataRequest = client.metadataCreateRequestWithFileID(fileID, scope: "enterprise", template: "poddemo", tasks: task as [AnyObject])
        metaDataRequest.performRequestWithCompletion(completionBlock)
        
    }

Scheme
screen shot 2017-01-23 at 11 16 21 am

screen shot 2017-01-23 at 11 16 09 am

Any help is appreciated, thank you!

Cheers

[sample app] image/video thumnails load small when fetched from cache

When you scroll through a folder that contains photos in the sample app, the thumbnails first load in normally. Then when scrolling back the other direction, the thumbnails that had previously loaded appear at ~half size.
This is just in regular scrolling through account contents in the Sample app.

BoxContentSDK.h not found

Hello,
Am I missing something? When I install this into my project using the directions for Cocoapods provided, I get about 9 or so errors that say "'BoxContentSDK/BoxContentSDK.h' file not found". This happens in BOXContentClient+Metadata.h, for example. You can clearly see it says "#import <BoxContentSDK/BoxContentSDK.h>" (and not BOXContentSDK.h).

I can't believe I am the only one this is happening too, and yet nobody is mentioning it anywhere else, so what am I doing wrong?

My Podfile has one line in it: pod 'box-ios-sdk' and I literally have no other code in my project other than stock Xcode 7 template code. I just run pod install, quit Xcode, open the .xcworkspace and Command-B and get the error.

Crash in BOXAPIDataOperation::connection:didReceiveData after canceling download

My app downloads a long list of video files. The operation must be cancelable, so I have a cancel button on the view, and when clicked, my controller walks the download queue and calls cancel on the corresponding BOXFileDownloadRequest, then the app goes on about its business. A good percentage of the time, this results in a crash (EXC_BAD_ACCESS) in connection:didReceiveData, apparently due to calling on an NSOutputStream that has already been closed.

Crash is on the first line in connection:didReceiveData:

while ([self.outputStream hasSpaceAvailable])

I added the following trace code to the close method to test it:

(void)close
{
    if (self.error.code == BOXContentSDKAPIErrorAccepted) {
        // for 202, we are going to re-enqueue so we don't want to mess with the stream.
    }
    else {
        NSLog(@"Removing %p as delegate for %p", self, _outputStream);
        self.outputStream.delegate = nil;
        [self.outputStream close];
        _outputStream = nil;
        NSLog(@"%p - output stream is nil", self);
    }
}

Not surprisingly, this made the crash much harder to reproduce, but I did eventually hit it. As expected, the first trace was emitted for the object in question, but not the second, so it appears the callback is coming in on another thread after the output stream is closed, but before it's set to nil. The output stream's delegate should already be set to nil, though - maybe a bug in NSOutputStream? Weird stuff.

Xcode 8, Swift getting "Could not build Objective-C module BoxContentSDK"

Hi,

I've followed following steps but I am getting "Could not build Objective-C module BoxContentSDK". while importing this file AppDelegate.

Please do the needful.

Thanks
Krishna

To add the BoxContentSDK to a swift project, we should create a new swift project. We can add a Podfile to this new project and work from there.

Preliminary info: I using xCode 7.1 beta and CocoaPods 0.38.2

Create the swift project -> New project -> Single Application -> < set project name, i.e. BoxContentSDKSampleApp-Swift > -> set type to swift and save to location

In the project folder (BoxContentSDKSampleApp-Swift) create a Podfile with the following info:

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '8.0'
pod 'box-ios-sdk', :git => '[email protected]:box/box-ios-sdk.git'

Run pod install and verify if completed without error:
$ pod install
Updating local specs repositories
Analyzing dependencies
Pre-downloading: box-ios-sdk from [email protected]:box/box-ios-sdk.git
Downloading dependencies
Installing box-ios-sdk 1.0.10 (was 1.0.10)
Generating Pods project
Integrating client project
Sending stats

Close the project and open the newly created workspace in the BoxContentSDKSampleApp-Swift folder:

You should see the BoxContentSDKSampleApp-Swift and a Pods projects in the the project navigator of the workspace.

Confirm you can build the project. CocoaPods configured the modulemap and umbrella header, this will allow us to call objective-c static library methods as well as message 'category' methods.

To consume BoxContentSDK, simply add 'import BoxContentSDK' to your swift files and make calls to the BoxContentSDK interface.

// Snippet of code to test the calls into BoxContentSDK - AppDelegate.swift

import UIKit
import CoreData
import BoxContentSDK

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

_ = BOXContentClient.self.setClientID("set client id", clientSecret: "set client secret")

self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let navController = UINavigationController()
let mainView = ViewController(nibName: nil, bundle: nil)

navController.viewControllers = [mainView]
self.window!.rootViewController = navController
self.window?.makeKeyAndVisible()

return true

}

Persisting the login step for Box user

Hello everyone, this is a general question not too sure if this is the right place to post it.

I was wondering is there a way to persist user credentials so users do not have to log in every-time the user wants to upload information to BOX?

Also does anyone know how long does the Authorization Token remains valid? (How long does it take for it to be expired?)

Cheers, will be waiting for your response!~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.