Coder Social home page Coder Social logo

livesdk-for-ios's Introduction

Annoucement: There's a new OneDrive SDK

The Live SDK has been replaced by the OneDrive API and OneDrive SDK for iOS. All new projects should use the OneDrive API to integrate with OneDrive instead of Live SDK.

This Live SDK project will remain available for existing applications to continue to use but new application development should be done using the OneDrive SDK.

Live SDK for iOS (legacy)

version 5.6

  1. Introduction

For integrating OneDrive into your iOS app use the OneDrive iOS SDK.

The repository here includes:

  • Live SDK Library source (src/LiveSDK/Library)
  • Live SDK framework (bin/LiveSDK.framework.zip)
  • Samples (src/samples)

For questions on how to use the sdk visit http://stackoverflow.com/questions/tagged/onedrive

  1. Reference the API

You can reference the iOS API in two ways.

###2.1 Install with Cocoapods

  • Install cocoapods following the getting started guide.
  • Add the following to your Podfile: pod 'LiveSDK'
  • Run the command pod install to install the latest LiveSDK pod.

###2.2 To reference the iOS API source code directly

  • Open your iOS project in Xcode.
  • Click File > Add Files to "Your Project Name".
  • Go to and select the src/LiveSDK/Library folder under your local copy of the repository and then click "Add".
  • In your code file that you want to reference the API source code, add this import statement: #import "LiveConnectClient.h".

#####Notes: If you reference the iOS API source code directly and you use Xcode 4.2 or later, you must disable Automatic Reference Counting (ARC). This is because the Live SDK for iOS library source code uses manual reference counting. If you want to use ARC, you can either reference the iOS API framework by following the steps in the previous section(see 2.1), or do an ARC conversion on the library source code.

  1. Documentation

Visit: http://dev.onedrive.com and click the "Develop” link.

License Agreement

Copyright 2015 Microsoft Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

livesdk-for-ios's People

Contributors

aclev avatar aviramuse avatar deepeshm avatar liwa avatar rgregg 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

livesdk-for-ios's Issues

How to persist the live connect session?

Every time I restart the simulator I have to login again because the LiveConnectSession session will be nil. Is there any way to persist the session to keychain? like google oauth sdk does?

Archive file(zip,rar) does not support to upload

Hi,liwa

When uploading Archive file

Error Domain=LiveServicesErrorDomain Code=5 "The operation couldn’t be completed. (LiveServicesErrorDomain error 5.)" UserInfo=0x1331860 {message=The requested operation could not be completed. The provided file type is not supported. Only photos, videos and document file types are supported., code=request_parameter_invalid}

Retaining delegate in LiveAuthRequest class

Problem:
Retaining delegate in initialization method of LiveAuthRequest class causes the memory leak.

Solution:
Replace code:

- (id) initWithClient:(LiveConnectClientCore *)client
               scopes:(NSArray *)scopes
currentViewController:(UIViewController *)currentViewController
             delegate:(id<LiveAuthDelegate>)delegate
            userState:(id)userState
{
    self = [super init];
    if (self) 
    {
        // ...
        _delegate = [delegate retain];
        // ...
    }

    return self; 
}

with the following code:

- (id) initWithClient:(LiveConnectClientCore *)client
               scopes:(NSArray *)scopes
currentViewController:(UIViewController *)currentViewController
             delegate:(id<LiveAuthDelegate>)delegate
            userState:(id)userState
{
    self = [super init];
    if (self) 
    {
        // ...
        _delegate = delegate;
        // ...
    }

    return self; 
}

And delete corresponding string in the dealloc method:

- (void)dealloc
{    
   // ...

    [_scopes release];
    //[_delegate release]; - these string should be deleted because we don't retain delegate while initialization.
    [_userState release];

    //...

    [super dealloc];
}

Best regards, Yuriy Muzyukin.

Can't use the sdk

Is this supposed to have a .framework file? I can't find it anywhere. I'm following the instructions of referencing the API source code directly, but it won't show me the login screen (it's just empty).

Regards,
F

add cocoapods support

Please add support for Cocoapods. This dependency manager for iOS is standard in the industry and pretty straightforward to set up.

Impossible to switch user, second log in doesn't work, no error code, webview exits by time out

When using LiveSDK I log out and try to log in again modal auth dialog is loaded but it is blank, no error code returned, after some time webview returns with timeout.
Issue can be reproduced in LiveSDKTestBed as well.
Steps to reproduce:
1)Log in
2)Log out
3)Log in again

In rare cases you would need to do 2-3 signouts, but mostly 1 would be enough.
If application is closed(killed) login works again.

Unable to submit the iOS8 app to Apple by using Xcode 6 with OneDrive integration

Hi,
This is Loganathan from SignEasy. We have integrated the OneDrive SDK in our iOS app (https://itunes.apple.com/app/signeasy/id381786507?mt=8). With iOS8 and Xcode6.0, when we submit the app to Apple, Xcode's binary uploader shows an error as attached below.

xcode6_submission_error

OneDrive SDK integration guide mentions that we need to include the SDK framework in the copy bundle resource, but Apple does not allow the submission of the app binary if we do so. If we don't add the OneDrive SDK framework in the copy bundle section, then SignEasy crashes when i try to initialize the library in our code.

Please let us know how we can fix this. I am reachable at [email protected].

Thanks,
Sunil

Bad Access on Successful Auth

I am attempting to authenticate Microsoft users using the LiveConnectClient class. I have setup my implementation exactly as is done in the examples. Upon a successful login, the login UI is dismissed, and then my application crashes with a Bad Access exception. Enabling NSZombies, I see the following error in the debugger on crashing:

[LiveAuthRequest authDialogDisappeared]: message sent to deallocated instance 0xdde5cc0

In one particular test I got a slightly different exception message, though my code hadn't changed:

[_NSCFDictionary authDialogDisappeared]: unrecognized selector sent to instance

I'm guessing that this only occurred because a dictionary happened to be allocated at the address of the recently deallocated LiveAuthRequest. Either way, this is a fatal error that is halting my integration of this SDK.

Hi re SkyDrive

I would liekto (am in the progress of) rewriting the livesdk client. I use it for myself, so this is not a community offering per se. But I just cant stand how this thing works. The only thing worse is the dropbox rest API. We are trying to compose things here, many times in blocks which are emenable to GCD threading etc. The fact that live SDK either returns succeeded or failed with mystery metadata is completely unacceptable. Ive worked around it for my purposes. But sincerely, I would like to offer to rewrite the whole obj C client. Not to make you feel bad or me feel good. This just isnt right. I have used it as is, and thats fine, But I have many more things to do and this API is just a pain. let me know.

Please add semantic version tags

CocoaPods is a tool for managing dependencies for OS X and iOS Xcode projects and provides a central repository for iOS/OS X libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, <LiveSDK-for-iOS> doesn't have any version tags. Currently a pod cannot be submitted to the podspec repository referencing a specific commit - a version tag must be specified.

Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.

In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:

$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags

Cannot sign in with sample code or my app

I entered my CLIENT_ID which I got from http://manage.dev.live.com/. I specified mobile for my application. Running on iOS 6.1 simulator.
I run the SDK with wl.signin and me
and I get:

We're unable to complete your request.
Microsoft account is experiencing technical problems. Please try again later.

Is there something else I need to do to get the sign in to work?

Thanks!

Aron

LiveSDK.framework not exists?

Hi..
I download this 5.6.1 release file and extract it.
But, I cannot find the LiveSDK.framework files
only LiveSDK_framework.

Failed to Login

Hi,

I just downloaded the SDK and I found this problem on my app and on your app(after changing the client ID) after confirming the permission:

Error Domain=LiveServicesErrorDomain Code=1 "The operation couldn’t be completed. (LiveServicesErrorDomain error 1.)" UserInfo=0x2018bfa0 {error_description=The authorization request failed to complete., internal_error=Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0x20187000 {NSErrorFailingURLKey=https://oauth.live.com/authorize?display=page&response_type=code&redirect_uri=https://oauth.live.com/desktop&scope=wl.signin&locale=en-GB&client_id=00000000400C3C10, NSErrorFailingURLStringKey=https://oauth.live.com/authorize?display=page&response_type=code&redirect_uri=https://oauth.live.com/desktop&scope=wl.signin&locale=en-GB&client_id=00000000400C3C10}, error=request_failed}

Steps to reproduce:

  1. Open the Login Dialog
  2. Login using account credentials
  3. Selected Yes on the app permission
  4. after the dialog closes, it goes to the AuthFailed Method,
    - (void) authFailed:(NSError *)error userState:(id)userState
    and displays the error above

Regards,
Jeffrey

LiveSDK Failed to request authorization

Dear all,
i have suffered in this case just a day ago, and there are no other similar case in the internet.
I was able to sign in to Live Services and passed the consent form a day ago. However, i was than failed to sign in through the Auth Dialog 9 hours after the first successful sign in, during the 9 hours, no code changes has been made.
The error message i received from XCode are shown below:
screen shot 2015-02-04 at 12 13 02 pm
Any Idea?

about LiveOperationCore.h

Hi, nice to meet you.

I find a issue about LiveOperationCore.

The property of delegate was set readonly,

but LiveOperation Class's method "setDelegate"

  • (void) setDelegate:(id)delegate
    {
    liveOpCore.delegate = delegate;
    }

Resume upload and uploading by pieces of data

I found that the upload only support NSData and NSInputStream, however when i upload an file larger than 1GB, the app will crash as the memory is limited, I found that someone adjust me to upload by NSFileHandler to post data by pieces, I separated the file to every piece of 1MB, and use the http-header "Content-Range", but it seems not work, it can only upload the first 1MB, and this is my code according to the msdn library, I didn't know if the server support this way:
NSData *putData = [self uploadSubdataWithOffset:offset length:dataLength];
NSString *rangeString = [NSString stringWithFormat:@"bytes */%lu-%lu/%lu",(unsigned long)offset,(unsigned long)offset+dataLength-1,(unsigned long)dataLength];
[_request setValue:rangeString forHTTPHeaderField:@"Content-Range"];
[_request setValue:[NSString stringWithFormat:@"%llu",(unsigned long long)_chunckSize] forHTTPHeaderField:@"Content-Length"];
[_request setValue:[NSString stringWithFormat:@"%llu",[_fileHandler seekToEndOfFile]] forHTTPHeaderField:@"X-Upload-Content-Length"];
[_request setValue:[self fileMimeType:uploadFilePath] forHTTPHeaderField:@"X-Upload-Content-Type"];

[bodyData resetBytesInRange:NSMakeRange(0, [bodyData length])];
[bodyData setLength:0];
NSString * boundary = @"A300x";
[bodyData appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[bodyData appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"file\"; filename=\"%@\"\r\n", uploadFileName] dataUsingEncoding:NSUTF8StringEncoding]];
[bodyData appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n\r\n", @"application/octet-stream"] dataUsingEncoding:NSUTF8StringEncoding]];
[bodyData appendData:putData];
[bodyData appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];

[_request setHTTPBody:putData];

_connection = [[NSURLConnection alloc] initWithRequest:_request delegate:self];
[_connection start];

As I need the uploading pause and resume, and the large file must support as well,so I had to do it by this, can you give me any help about this? Thanks very much for your patient

Remove xcuserdata from repo

src/LiveSDK.xcodeproj/xcuserdata/liwa.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
src/LiveSDK.xcodeproj/xcuserdata/liwa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
src/LiveSDK.xcodeproj/xcuserdata/liwa.xcuserdatad/xcschemes/LiveSDK.xcscheme
src/LiveSDK.xcodeproj/xcuserdata/liwa.xcuserdatad/xcschemes/LiveSDKAggregate.xcscheme src/LiveSDK.xcodeproj/xcuserdata/liwa.xcuserdatad/xcschemes/LiveSDKForiOS.xcscheme src/LiveSDK.xcodeproj/xcuserdata/liwa.xcuserdatad/xcschemes/xcschememanagement.plist

For scope 'wl.offline_access' logout with [liveClient logout] completely from service, not just clear cookies

Currently logout is simply clearing cookies and not logging out from OneDrive.

If we grant access to app with scopes including "wl.offline_access" and after we call [liveClient logout], we can sign in again without entering password and granting access to app.

By removing scope "wl.offline_access" we need to grant access (press YES/NO in webView) for app every first upload/quiery/sign in operation after restarting the application.

Current behavior does not allow to use multiple accounts on one device. Only reinstalling the app helps to sign out completely.

Please, add/rewrite the method to logout fully.

Thanks in advance.

LiveSDK can't login again in IOS6.0

I run LiveSDK in IOS5.1, everything is OK , the demo in the package runs very well . But after i changed to IOS6.0 , once after I signed in , I got some error message in the console:

2013-04-26 21:51:06.267 LiveSDKTestBed[6820:17607] 6820: CFNetwork internal error (0xc01a:/SourceCache/CFNetwork_Sim/CFNetwork-609/Connection/URLConnectionLoader.cpp:471)
2013-04-26 21:51:06.268 LiveSDKTestBed[6820:17607] 6820: CFNetwork internal error (0xc01a:/SourceCache/CFNetwork_Sim/CFNetwork-609/Connection/URLConnectionLoader.cpp:635)

then after I signed out and signed in again the dialog is there with no sign in web page to load.After a few seconds the dialog automaticlly dismissed and I got the error message below:

2013-04-26 21:57:16.978 LiveSDKTestBed[6820:11303] Error received. Context: auth failed during login
2013-04-26 21:57:16.980 LiveSDKTestBed[6820:11303] Error detail: Error Domain=LiveServicesErrorDomain Code=1 "The operation couldn’t be completed. (LiveServicesErrorDomain error 1.)" UserInfo=0x889c590 {error_description=The authorization request failed to complete., internal_error=Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x88a6a40 {NSErrorFailingURLStringKey=https://login.live.com/oauth20_authorize.srf?display=ios_tablet&response_type=code&redirect_uri=https://login.live.com/oauth20_desktop.srf&scope=wl.signin&locale=en&client_id=00000000440E9722, NSErrorFailingURLKey=https://login.live.com/oauth20_authorize.srf?display=ios_tablet&response_type=code&redirect_uri=https://login.live.com/oauth20_desktop.srf&scope=wl.signin&locale=en&client_id=00000000440E9722, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x75c7da0 "The request timed out."}, error=request_failed}

I can find what the problem it is .

Crash issue in the StreamReader

Crash issue

  • (id)initWithStream:(NSInputStream *)stream
    delegate:(id)delegate
    {
    self = [super init];
    if (self)
    {
    _stream = stream; //NEED RETAIN
    _delegate = delegate;
    }

    return self;
    }

  • (void)dealloc
    {
    [_stream release];
    [data release];

    [super dealloc];
    }

logoutWithDelegate does not clear cookie?

I try to use [liveClient logoutWithDelegate:self userState:@"logout"] to logout and clear last cookie, but afterwards I invoke [self.liveClient login:self scopes:scope delegate:self userState:@"signin"]; and LiveSDK does not show the user/password input page.

Is this a bug, or is there any other way to really logout as clearing cookies please kindly help to tell me, thanks.

Crash and memory corruption if "@synthesize varName" and invoking their @selectors like ["varName" function] instead of ["self.varName" function]

Hey, I want to start by thanking you for implementing this awesome support!

There are some problems with ARC (i tested it in Xcode Version 6.1.1 (6A2008a)) with variables that are "@synthesize varName" and invoking their @selectors like ["varName" function] instead of ["self.varName" function] will throw an "unknown selector exception" because, it seems, that the variable gets an arbitrary type that does not have implemented that selector, or if the random type implements the @selector "function" then the object pointed by "varName" will be released and deallocated from memory.

For example in file LiveConnectClientCore.m
@synthesize clientId = _clientId,
scopes = _scopes,
session = _session,
status = _status,
authRequest = _authRequest,
authRefreshRequest;

FUNCTION:

  • (void)dealloc
    {
    [authRefreshRequest cancel];
    --here "authRefreshRequest" has some times type NSData, some times NSString, etc... and it will crash with "unknown selector exception" since none of this types don't implement "cancel" method.
    --calling [self.authRefreshRequest cancel] will fix the problem.

    [_clientId release];
    [_scopes release];
    [_session release];
    [_authRequest release];
    [_storage release];

    [authRefreshRequest release];
    --here at this call will release arbitrary objects from memory
    --calling [self.authRefreshRequest release]; will fix the problem

    [super dealloc];
    }

    Similar problems are in multiple files:

  • LiveAuthDialog.m: @synthesize webView, canDismiss,

  • LiveAuthRefreshRequest.m: @synthesize tokenConnection, tokenResponseData;

  • LiveDownloadOperation.m: @synthesize data;

  • LiveOperation.m: @synthesize liveOpCore;

  • LiveOperationCore.m: @synthesize streamReader,
    request,
    publicOperation,
    rawResult,
    result,
    connection,
    httpResponse,
    responseData,
    completed,
    httpError;

  • StreamReader.m: @synthesize data,

The problem is most visible and frequent in LiveConnectClientCore.m for @syntethize authRefreshRequest.

Steps to reproduce in an ARC enabled project with LiveSDK pod installed
A) Obtain an access token for an OneDrive account with "wl.offline_access" visible in scopes;
B) Kill the application;
C)Start the application (at this moment an refresh token exists and authRefreshRequest will be instantiated).
D)Do a logout like this:
[self.liveConnectClient logout];
self.liveConnectClient = nil;

  • Observe in LiveConnectClientCore.m -(void) dealloc "unknown selector exception" when calling [authRefreshRequest cancel] => authRefreshRequest has wrong type or if a random type implements @selector cancel then the object pointing to authRefreshRequest address will be released and deallocated from memory.

Thanks,
Have a nice day!

List Files API

Thanks for the sdk but I did not found the api of list the files at one path, i need to get the file list show, can you please tell me how to do it? Thanks

Download file to Disk

LiveConnectClient don't show any method to download a big file to disk and not to memory .
Is there a way to download directly to disk?

Thank you
Scinfu

Several memory management issues

I'm using the latest version (5.6.1) and I have found a few memory management issues.

  1. LiveConnectClientCore.m. In the refreshSessionWithDelegate:userState: method, the assignment to the authRefreshRequest ivar needs to be changed to self.authRefreshRequest or the autorelease needs to be removed.
  2. LiveAuthStorage.m. In the initWithClientId: method, the assignment to _clientId needs a copy (or retain). This problem doesn't appear when passing in a string literal but it causes a crash otherwise.

Mistakes in memory management

Hello.

First of all: thanks for you work guys!
I have inspected source code of SDK and found some bugs in memory management.
So look at them.

  1. Class LiveConnectClientCore
- (id) initWithClientId:(NSString *)clientId
                 scopes:(NSArray *)scopes
               delegate:(id<LiveAuthDelegate>)delegate
              userState:(id)userState
{
        self = [super init];
        if (self) 
        {
            ...
            _storage = [[[LiveAuthStorage alloc] initWithClientId:clientId] retain];
            ...
        }

        [self refreshSessionWithDelegate:delegate
                               userState:userState];
        return self;
}
  • Object _storage is retained twice.
  1. Class LiveConnectClientCore
- (void) refreshSessionWithDelegate:(id<LiveAuthDelegate>)delegate
                          userState:(id)userState
{
        if ([LiveAuthHelper shouldRefreshToken:_session 
                                  refreshToken:_storage.refreshToken]) 
        {
            authRefreshRequest = [[[LiveAuthRefreshRequest alloc] initWithClientId:_clientId 
                                                                            scope:_scopes 
                                                                     refreshToken:_storage.refreshToken
                                                                         delegate:delegate
                                                                        userState:userState 
                                                                       clientStub:self] 
                                 retain];

            ...
        }
        else
        {
            ...
        }
}
  • Object authRefreshRequest is retained twice.
  1. Class LiveConnectClient
- (id) initWithClientId:(NSString *)clientId
                 scopes:(NSArray *)scopes
               delegate:(id<LiveAuthDelegate>)delegate
              userState:(id)userState
{
        ...
        if (self) 
        {
            _liveClientCore = [[[LiveConnectClientCore alloc] initWithClientId:clientId 
                                                                       scopes:[LiveAuthHelper normalizeScopes:scopes] 
                                                                     delegate:delegate 
                                                                    userState:userState]
                               retain];
        }

        return self;
}
  • Object _liveClientCore is retained twice.
  1. Class LiveAuthRequest
- (void)authorize
{
        ...    
        self.authViewController = [[LiveAuthDialog alloc] initWithNibName:nibName
                                                                   bundle:[LiveAuthHelper getSDKBundle] 
                                                                 startUrl:authRequestUrl 
                                                                   endUrl:[LiveAuthHelper getDefaultRedirectUrlString]
                                                                 delegate:self];
        ...
}
  • Object _authViewController is retained twice. (self.authViewController – is calling retain-setter for authViewController, which value is stored in _authViewController)
  1. Class LiveAuthHelper
+ (id) readAuthResponse:(NSData *)data
{
        NSString* responseString = [[NSString alloc] initWithData:data
                                                         encoding:NSUTF8StringEncoding];
        ...
        if (accessToken != nil) 
        {
            ...
        }
        else 
        {
            if (error == nil)
            {
                return [LiveAuthHelper createAuthError:LIVE_ERROR_CODE_LOGIN_FAILED
                                                  info:params];
            }
            else
            {
                return [LiveAuthHelper createAuthError:LIVE_ERROR_CODE_RETRIEVE_TOKEN_FAILED
                                              errorStr:LIVE_ERROR_CODE_S_RESPONSE_PARSING_FAILED 
                                           description:[NSString stringWithFormat:@"Unable to read response: %@", responseString]
                                            innerError:error];
            }

            return error;
        }
}
  • Object responseString is not released in the method.
  • The last string of the method is unreachable.
  1. Class NSDate (MSJSON_Extensions) (file: JsonParser.m)
- (id) initWithJSONStringValue:(NSString*)value
{
        long long timeValue = 0L;
        NSDate *date = nil;
        ...
        if ([scanner scanString:@"/Date(" intoString:NULL] || [scanner scanString:@"\\/Date(" intoString:NULL])
        {
            ...
            date = [[NSDate dateWithTimeIntervalSince1970:(timeValue / 1000.0)] retain];
            return date;
        }
        ...
        [self release];
}
  • The call: [NSDate dateWithTimeIntervalSince1970:(timeValue / 1000.0)] returns autoreleased object. So we don't need to retain it before returning from our method.
  • Using goto - is it good approach?
  • Calling: [self release] - why?

And some mistakes with retaining delegates.

  1. Class LiveAuthRequest (issue 6)
    Class retains delegate and it causes memory leak. Code should be fixed in: initialization and dealloc.
  2. Class LiveAuthRefreshRequest
    Class retains delegate and it causes memory leak. Code should be fixed in: initialization, dealloc and - (void)complete method.
  3. Class LiveOperationCore
    Class retains delegate and it causes memory leak. Code should be fixed in: header file (property), dealloc and initialization methods:
- (id) initWithMethod:(NSString *)method
                     path:(NSString *)path
              requestBody:(NSData *)requestBody
                 delegate:(id)delegate
                userState:(id)userState
               liveClient:(LiveConnectClientCore *)liveClient;
- (id) initWithMethod:(NSString *)method
                     path:(NSString *)path
              inputStream:(NSInputStream *)inputStream
                 delegate:(id)delegate
                userState:(id)userState
               liveClient:(LiveConnectClientCore *)liveClient;
  1. Class StreamReader
    Class does not retain delegate while initialization, but releases it in dealloc method and property delegate is retain. So code should be fixed in: header file (property) and dealloc.

+[June 13, 2012]
Class LiveOperation

- (id) initWithOpCore:(LiveOperationCore *)opCore
{
    self = [super init];
    if (self) 
    {
        liveOpCore = opCore;
        liveOpCore.publicOperation = self;
    }

    return self;
}

This initialization method creates cycle. So LiveOperation and LiveOperationCore objects will not be deallocated.

Best regards, Yuriy Muzyukin

Non public API Error iOS 7

Hi,

I'm trying to submit my app to the App Store. The app uses the latest LiveSDK. The validation tool triggers a non-public API usage, which is caused by this sdk.

Screenshot:
screen shot 2013-09-11 at 1 36 05 am

The SDK is quite buggy

1.It has a lot of memory leak
2.When I try to login, sometimes it success, but many times it failed with some strange code=-999
3.Your sample code can not sign in!

Resize photos to 2048 px

Hi, liwa

If the photo is larger than 2048x2048,photo will resize photos to 2048 px automatically.
Can I upload a photo as origonal file size to SkyDrive?

How i can Set an existing LiveConnectSession to the LiveConnectClient?

i'm trying to implement a multi connexion on my ios app so i can add two oneDrive account on my app , so i need to save the LiveConnectSession and set it to the current LiveConnectClient but the session property of the LiveConnectClient is readonly , so is there any way to do this?

Upload fails with timeout after 120 seconds

Hello,
When I'm uploading a big file using

    self.uploadOperation = [self.liveClient uploadToPath:path
                                           fileName:file.name
                                        inputStream:fileStream
                                          overwrite:liveOverwrite
                                           delegate:self
                                          userState:@"uploadFile"];

It starts uploading the file as expected (the progress delegate is correctly called), but after 120 seconds it stop uploading and is returning a timeout error ...

LiveSDK framework does not get linked with iOS6 (for iphone 5)

LiveSDK framework is running into linking errors in build phase for iOS6.

ld: file is universal (3 slices) but does not contain a(n) armv7s slice: LiveSDK.framework for architecture armv7s

It looks like that LiveSDK must be recompiled for iOS6 in xcode4.5 to generate LiveSDK framework for new armv7s architecture.

Anyway to set a existing session to LiveConnectClient?

My app saves tokens back to server to give user cross devices/platform experience. But I can't find a way to set tokens back to a LiveConnectSession. I have to reference the whole SDK source code, instead of the binary framework. It would be wonderful if you guys can simply support this feature, thanks!

LiveServicesErrorDomain Code=5

Error Domain=LiveServicesErrorDomain Code=5 "The operation couldn’t be completed. (LiveServicesErrorDomain error 5.)" UserInfo=0xaa965b0 {message=The provided URL is not valid. The requested path 'XXXXX' is not supported., code=request_url_invalid}

building from xcode6 crashes the app after authenticated with liveSDK (caused by self.liveClient)

I have an app in the store that use LiveSDK API to log the user into OneDrive. The last release was pushed before iOS8 came out, but it works without problem with iOS8

Now I want to push an update (unrelated to OneDrive features) and I am using xcode 6.1.1 but testing the app I noticed that every time the user is authenticated into OneDrive the app will crash as soon as return from a segue or flipside view to the Main View.

I was able to isolate the issue to this line added in viewDidLoad:

self.liveClient = [[LiveConnectClient alloc] initWithClientId:APP_CLIENT_ID
delegate:self
userState:@"initialize"];
and I really followed the basic instructions on how to login that can be found here:

http://msdn.microsoft.com/en-us/library/dn631822.aspx#sign_the_user_in

The steps to reproduce the issue (on both thee device and the simulator) are the following:

a) app starts b) click to the cloud service login button that will trigger a flipsideviewcontroller c) log into OneDrive with the code provided by MS d) go back to the main controller e) CRASH!

The trace is the following:

*** First throw call stack:
(
0 CoreFoundation 0x028dd1e4 exceptionPreprocess + 180
1 libobjc.A.dylib 0x026598e5 objc_exception_throw + 44
2 CoreFoundation 0x0297a243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x028cd50b __forwarding
+ 1019
4 CoreFoundation 0x028cd0ee _CF_forwarding_prep_0 + 14
5 CloudFella 0x0015c867 -[LiveConnectClientCore dealloc] + 48
6 libobjc.A.dylib 0x0266a692 _ZN11objc_object17sidetable_releaseEb + 268
7 libobjc.A.dylib 0x0266baeb -[NSObject release] + 25
8 CloudFella 0x00158af1 -[LiveConnectClient dealloc] + 44
9 libobjc.A.dylib 0x0266a692 _ZN11objc_object17sidetable_releaseEb + 268
10 libobjc.A.dylib 0x02669e81 objc_release + 49
11 libobjc.A.dylib 0x02669e3e objc_storeStrong + 39
12 CloudFella 0x00157b9d -[CFFlipsideViewController .cxx_destruct] + 249
13 libobjc.A.dylib 0x026582d4 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 128
14 libobjc.A.dylib 0x0265824f object_cxxDestruct + 20
15 libobjc.A.dylib 0x0266327a objc_destructInstance + 48
16 libobjc.A.dylib 0x026632ab object_dispose + 20
17 UIKit 0x01433d1a -[UIViewController dealloc] + 1854
18 UIKit 0x01430915 -[UIViewController release] + 89
19 libobjc.A.dylib 0x02669e97 objc_release + 71
20 libobjc.A.dylib 0x02656bf0 objc_setProperty_nonatomic + 48
21 UIKit 0x01a6167d -[_UIViewControllerOneToOneTransitionContext _setFromViewController:] + 47
22 UIKit 0x01a61490 -[_UIViewControllerOneToOneTransitionContext dealloc] + 43
23 libobjc.A.dylib 0x0266a692 _ZN11objc_object17sidetable_releaseEb + 268
24 libobjc.A.dylib 0x0266baeb -[NSObject release] + 25
25 UIKit 0x01a60834 -[_UIViewControllerTransitionContext completeTransition:] + 135
26 UIKit 0x01a7a5b1 -[UIViewControllerBuiltinTransitionViewAnimator transitionViewDidComplete:fromView:toView:removeFromView:] + 50
27 UIKit 0x01416137 -[UITransitionView notifyDidCompleteTransition:] + 345
28 UIKit 0x01415e61 -[UITransitionView _didCompleteTransition:] + 1333
29 UIKit 0x014181b7 -[UITransitionView _transitionDidStop:finished:] + 107
30 UIKit 0x013666dc -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 267
31 UIKit 0x013669c8 -[UIViewAnimationState animationDidStop:finished:] + 80
32 QuartzCore 0x00fd6bb4 _ZN2CA5Layer23run_animation_callbacksEPv + 304
33 libdispatch.dylib 0x0326b4d0 _dispatch_client_callout + 14
34 libdispatch.dylib 0x03259726 _dispatch_main_queue_callback_4CF + 340
35 CoreFoundation 0x0294243e CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 14
36 CoreFoundation 0x028835cb __CFRunLoopRun + 1963
37 CoreFoundation 0x028829d3 CFRunLoopRunSpecific + 467
38 CoreFoundation 0x028827eb CFRunLoopRunInMode + 123
39 GraphicsServices 0x0301f5ee GSEventRunModal + 192
40 GraphicsServices 0x0301f42b GSEventRun + 104
41 UIKit 0x01316f9b UIApplicationMain + 1225
42 CloudFella 0x000eeea6 main + 94
43 libdyld.dylib 0x034af6d9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

If I log into the other cloud services available in my app I got no issues at all.

The problem is happening with both the old LiveSDK API (the one included in the current good release out in the store) and the newest build (2 months old) added to the app to solve some validation issues described here: #43

I suspect that going from Xcode 5 to xcode 6 something changed in the building parameters that is causing the issue, however I am not sure where the issue is and how to workaround.

As test I forced building the app for 32 bit architectures only but it crashed as well: this was expected as the LiveSDK API is compatible with 64 bit arch, but certainly wanted to try... .

Any help is greatly appreciated.

Thanks, dom

New version

Hi,
Please Create a new release (the last one is 4 mouthes ago)with the commit "Merge pull request #62 from aclev/fixMemoryIssues "
I'm using cocoapods, and the SDK crashed on the dealloc.

7

Titel

Unsupported architectures error

I followed your instructions as detailed in the ReadMe to add as a framework, but I am unable to get the project into the App Store with Xcode 6.1. The project works fine in the simulator and devices.

The error says: "iTunes Store operation failed. Unsupported Architectures. Your executable contains unsupported architectures '[x86_64, i386]'."

The error does go away if I remove the Live SDK.

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.