Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in BFTask+Private.m #611

Closed
aldmitriev opened this issue Nov 30, 2015 · 9 comments
Closed

Crash in BFTask+Private.m #611

aldmitriev opened this issue Nov 30, 2015 · 9 comments

Comments

@aldmitriev
Copy link

I try to login or become PFUser session in WatchOS2 Extension. But it crashing on BFTask+Private.m on 117th string
I used " branch => 'nlutsenko.watchOS' "
I tried to login or become (also inBackground and withblocks etc), but same result.
I use Objective-C

So I have few questions:

  1. Is it a bug?
  2. How can I fix it fast?
  3. Need I change the branch? please, suggest me correct pod string, if yes. Because I have a pod warning when I use something instead nlutsenko.watchOS branch: [!] The platform of the target AppWatch Extension (watchOS 2.0) is not compatible with Parse (1.10.0), which does not support watchos.
  4. Need I change something else? Maybe switch on or off something in target settings. Any suggestions?

Thank you.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid class name. Class names cannot start with an underscore.'
*** First throw call stack:
(
    0   CoreFoundation                      0x00f30af4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x009eedf4 objc_exception_throw + 50
    2   CoreFoundation                      0x00f30a1d +[NSException raise:format:] + 141
    3   AppWatch Extension          0x00127d33 +[PFObject(Private) _assertValidInstanceClassName:] + 227
    4   AppWatch Extension          0x00133c61 -[PFObject init] + 593
    5   AppWatch Extension          0x001340d2 -[PFObject initWithObjectState:] + 114
    6   AppWatch Extension          0x0013429d +[PFObject objectWithClassName:objectId:completeData:] + 365
    7   AppWatch Extension          0x0017413a -[PFOfflineStore getOrCreateObjectWithoutDataWithClassName:objectId:] + 458
    8   AppWatch Extension          0x00134819 +[PFObject objectWithoutDataWithClassName:objectId:] + 233
    9   AppWatch Extension          0x000e362f -[PFDecoder _decodePointerForClassName:objectId:] + 127
    10  AppWatch Extension          0x000e2fff -[PFDecoder decodeDictionary:] + 1407
    11  AppWatch Extension          0x000e3b4f -[PFDecoder decodeObject:] + 159
    12  AppWatch Extension          0x0012f45e __69-[PFObject(Private) _mergeFromServerWithResult:decoder:completeData:]_block_invoke_2 + 798
    13  CoreFoundation                      0x00f2f8b9 ____NSDictionaryEnumerate_block_invoke417 + 41
    14  CoreFoundation                      0x00e12992 CFBasicHashApply + 130
    15  CoreFoundation                      0x00e4f93a __NSDictionaryEnumerate + 282
    16  CoreFoundation                      0x00e4f79d -[NSDictionary enumerateKeysAndObjectsWithOptions:usingBlock:] + 45
    17  CoreFoundation                      0x00e4f6e5 -[NSDictionary enumerateKeysAndObjectsUsingBlock:] + 53
    18  AppWatch Extension          0x0012efec __69-[PFObject(Private) _mergeFromServerWithResult:decoder:completeData:]_block_invoke + 284
    19  AppWatch Extension          0x001d1452 -[PFUserState initWithState:mutatingBlock:] + 194
    20  AppWatch Extension          0x001d16f4 -[PFUserState copyByMutatingWithBlock:] + 116
    21  AppWatch Extension          0x0012ed4a -[PFObject(Private) _mergeFromServerWithResult:decoder:completeData:] + 330
    22  AppWatch Extension          0x001bd317 -[PFUser(Private) _mergeFromServerWithResult:decoder:completeData:] + 1255
    23  AppWatch Extension          0x0012e231 -[PFObject(Private) _mergeAfterFetchWithResult:decoder:completeData:] + 193
    24  AppWatch Extension          0x001287d0 +[PFObject(Private) _objectFromDictionary:defaultClassName:completeData:decoder:] + 432
    25  AppWatch Extension          0x001283fa +[PFObject(Private) _objectFromDictionary:defaultClassName:completeData:] + 218
    26  AppWatch Extension          0x001cd3aa __80-[PFUserController logInCurrentUserAsyncWithUsername:password:revocableSession:]_block_invoke60 + 474
    27  AppWatch Extension          0x000b5a6f __62-[BFTask continueWithExecutor:successBlock:cancellationToken:]_block_invoke + 175
    28  AppWatch Extension          0x000b4c4e __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 126
    29  AppWatch Extension          0x000b08d0 __29+[BFExecutor defaultExecutor]_block_invoke_2 + 176
    30  AppWatch Extension          0x000b138a -[BFExecutor execute:] + 106
    31  AppWatch Extension          0x000b4b59 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 217
    32  AppWatch Extension          0x000b43ff -[BFTask runContinuations] + 719
    33  AppWatch Extension          0x000b38cf -[BFTask trySetResult:] + 287
    34  AppWatch Extension          0x000b6737 -[BFTaskCompletionSource setResult:] + 119
    35  AppWatch Extension          0x000b5112 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 530
    36  AppWatch Extension          0x000b4c4e __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 126
    37  AppWatch Extension          0x000b08d0 __29+[BFExecutor defaultExecutor]_block_invoke_2 + 176
    38  AppWatch Extension          0x000b138a -[BFExecutor execute:] + 106
    39  AppWatch Extension          0x000b4b59 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 217
    40  AppWatch Extension          0x000b43ff -[BFTask runContinuations] + 719
    41  AppWatch Extension          0x000b38cf -[BFTask trySetResult:] + 287
    42  AppWatch Extension          0x000b6737 -[BFTaskCompletionSource setResult:] + 119
    43  AppWatch Extension          0x000b5112 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 530
    44  AppWatch Extension          0x000b4d71 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 417
    45  AppWatch Extension          0x000b08d0 __29+[BFExecutor defaultExecutor]_block_invoke_2 + 176
    46  AppWatch Extension          0x000b138a -[BFExecutor execute:] + 106
    47  AppWatch Extension          0x000b4b59 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 217
    48  AppWatch Extension          0x000b43ff -[BFTask runContinuations] + 719
    49  AppWatch Extension          0x000b38cf -[BFTask trySetResult:] + 287
    50  AppWatch Extension          0x000b6737 -[BFTaskCompletionSource setResult:] + 119
    51  AppWatch Extension          0x000b5112 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 530
    52  AppWatch Extension          0x000b4c4e __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 126
    53  AppWatch Extension          0x000b08d0 __29+[BFExecutor defaultExecutor]_block_invoke_2 + 176
    54  AppWatch Extension          0x000b138a -[BFExecutor execute:] + 106
    55  AppWatch Extension          0x000b4b59 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 217
    56  AppWatch Extension          0x000b43ff -[BFTask runContinuations] + 719
    57  AppWatch Extension          0x000b38cf -[BFTask trySetResult:] + 287
    58  AppWatch Extension          0x000b6737 -[BFTaskCompletionSource setResult:] + 119
    59  AppWatch Extension          0x000b5112 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 530
    60  AppWatch Extension          0x000b4c4e __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 126
    61  AppWatch Extension          0x000b08d0 __29+[BFExecutor defaultExecutor]_block_invoke_2 + 176
    62  AppWatch Extension          0x000b138a -[BFExecutor execute:] + 106
    63  AppWatch Extension          0x000b4b59 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 217
    64  AppWatch Extension          0x000b43ff -[BFTask runContinuations] + 719
    65  AppWatch Extension          0x000b38cf -[BFTask trySetResult:] + 287
    66  AppWatch Extension          0x000b6737 -[BFTaskCompletionSource setResult:] + 119
    67  AppWatch Extension          0x000b5112 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 530
    68  AppWatch Extension          0x000b4c4e __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 126
    69  AppWatch Extension          0x000b08d0 __29+[BFExecutor defaultExecutor]_block_invoke_2 + 176
    70  AppWatch Extension          0x000b138a -[BFExecutor execute:] + 106
    71  AppWatch Extension          0x000b4b59 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 217
    72  AppWatch Extension          0x000b43ff -[BFTask runContinuations] + 719
    73  AppWatch Extension          0x000b38cf -[BFTask trySetResult:] + 287
    74  AppWatch Extension          0x000b6737 -[BFTaskCompletionSource setResult:] + 119
    75  AppWatch Extension          0x000b5112 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_3 + 530
    76  AppWatch Extension          0x000b4d71 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 + 417
    77  AppWatch Extension          0x000b08d0 __29+[BFExecutor defaultExecutor]_block_invoke_2 + 176
    78  AppWatch Extension          0x000b138a -[BFExecutor execute:] + 106
    79  AppWatch Extension          0x000b4b59 __55-[BFTask continueWithExecutor:block:cancellationToken:]_block_invoke + 217
    80  AppWatch Extension          0x000b43ff -[BFTask runContinuations] + 719
    81  AppWatch Extension          0x000b38cf -[BFTask trySetResult:] + 287
    82  AppWatch Extension          0x000b6ab7 -[BFTaskCompletionSource trySetResult:] + 119
    83  AppWatch Extension          0x001b58eb -[PFURLSessionDataTaskDelegate _taskDidFinish] + 283
    84  AppWatch Extension          0x001b83f9 -[PFURLSessionJSONDataTaskDelegate _taskDidFinish] + 3721
    85  AppWatch Extension          0x001b6147 -[PFURLSessionDataTaskDelegate URLSession:task:didCompleteWithError:] + 439
    86  AppWatch Extension          0x001b124c -[PFURLSession URLSession:task:didCompleteWithError:] + 204
    87  CFNetwork                           0x040c5782 __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke172 + 110
    88  Foundation                          0x006476e3 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    89  Foundation                          0x0056b16a -[NSBlockOperation main] + 108
    90  Foundation                          0x0054b51e -[__NSOperationInternal _start:] + 697
    91  Foundation                          0x0054b25e -[NSOperation start] + 83
    92  Foundation                          0x0054b09c __NSOQSchedule_f + 245
    93  libdispatch.dylib                   0x02d1040d _dispatch_client_callout + 14
    94  libdispatch.dylib                   0x02cf8102 _dispatch_queue_drain + 1065
    95  libdispatch.dylib                   0x02cf7a4d _dispatch_queue_invoke + 563
    96  libdispatch.dylib                   0x02cf94f6 _dispatch_root_queue_drain + 442
    97  libdispatch.dylib                   0x02cf9335 _dispatch_worker_thread3 + 108
    98  libsystem_pthread.dylib             0x0302a270 _pthread_wqthread + 1050
    99  libsystem_pthread.dylib             0x03027f82 start_wqthread + 34
)
libc++abi.dylib: terminating with uncaught exception of type NSException

private
tread

@nlutsenko
Copy link
Contributor

You are indeed using the correct branch, since we are still in beta for watchOS 2 (you can track the progress in #179).
Could you confirm that Parse SDK is initialized the moment you invoke PFUser.logInWithUsername:password:?

This crash suggests that you are trying to decode the object for a class that starts with an underscore (most likely _User in this case) and it didn't recognize it properly, probably due to the fact that PFUser wasn't yet registered, which happens at the time you initialize Parse SDK.

@parse-github-bot
Copy link

Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.

Please try the latest SDK. Our release notes have details about what issues were fixed in each release.

In addition, you might find the following resources helpful:

@aldmitriev
Copy link
Author

@nlutsenko Yes, I shared the report of a invoked [PFUser logInWithUsername: password:]

And I have a crashes with [PFUser become:]

At first time I used sessionToken

-(void) session:(WCSession *)session didReceiveMessage:(NSDictionary<NSString *,id> *)message
{
    NSLog(@"%@",message);
    if ([message valueForKey:@"currentSession"]) {
        if (![PFUser currentUser]){
            [PFUser become:[message valueForKey:@"currentSession"]]; //<<I HAVE THE CRASH HERE
            NSLog(@"%@",[PFUser currentUser]);
        }
    }
}

And than I tried to catch a bug

        [Parse setApplicationId:@"APPID" clientKey:@"KEY"];
        [PFUser logInWithUsername:@"CORRECTUSERNAME" password:@"CORRECTPASSWORD"];

Same result. I opened this issue after that.
Also I tried any login or become methods.
All usernames, passwords and tokens were correct.

I suspect the disconnected internet connection for WatchOS 2 Simulator. But the Map app is work and connection is strong. I don't know.
Thank you Nikita. My bad, I thought it's not beta from 1.10

@nlutsenko
Copy link
Contributor

Could you share the project or repro piece here?
I'll be more than willing to look into it.

@aldmitriev
Copy link
Author

AS IS. Confidential data was replaced.
It's the most terrible and (maybe) important pieces of code 😱

- (void)awakeWithContext:(id)context {
    [super awakeWithContext:context];
    if ([Parse isLocalDatastoreEnabled]==NO){
        [Parse enableLocalDatastore]; 
//        [Parse enableDataSharingWithApplicationGroupIdentifier:@"group.com.domain.app" containingApplication:@"com.domain.app"];
        [Parse setApplicationId:@"AppID" clientKey:@"Key"];
       // [PFUser logInWithUsername:@"testuser" password:@"pass"]; ///DEBUG
        if ([WCSession isSupported]) {
            _session = [WCSession defaultSession];
            _session.delegate = self;
            [_session activateSession];

        }

    }
}


-(void) session:(WCSession *)session didReceiveMessage:(NSDictionary<NSString *,id> *)message
{
    NSLog(@"%@",message);
    if ([message valueForKey:@"currentSession"]) {
        if (![PFUser currentUser]){
            [PFUser become:[message valueForKey:@"currentSession"]];
            NSLog(@"%@",[PFUser currentUser]);
        }
    }
    _ObjId = [message valueForKey:@"objectObjectId"];
}

Import in .h file

#import <WatchKit/WatchKit.h>
#import <Foundation/Foundation.h>
#import <Parse/Parse.h>
#import <Bolts/Bolts.h>
#import "DZWKTableCell.h"
@import WatchConnectivity;

@interface InterfaceController : WKInterfaceController <WCSessionDelegate>

Podfile

#use_frameworks!

...

target 'AppWatch Extension', :exclusive => true do
  platform :watchos
  pod 'Parse', :git => '[email protected]:ParsePlatform/Parse-SDK-iOS-OSX.git', :branch => 'nlutsenko.watchOS'
end

@nlutsenko
Copy link
Contributor

Since this is probably watchOS 2 app you probably have a class that confirms to WKExtensionDelegate - what happens if you place the following inside applicationDidFinishLaunching method there.

[Parse enableLocalDatastore];
[Parse setApplicationId:@"a" clientKey:@"b"];

@aldmitriev
Copy link
Author

@nlutsenko Thank you for the correct direction, Nikita
applicationDidFinishLaunching never called.
It's looking like settings problem.

I changed in my .h file

@import WatchConnectivity;
@import WatchKit;

@interface InterfaceController : WKInterfaceController <WCSessionDelegate,WKExtensionDelegate>

also I changed Info.plist

WKExtensionDelegateClassName
ExtensionDelegate → $(PRODUCT_MODULE_NAME) 

Still not calling.
I'll discover it to fix and I will tell you.

UPD: Of course

-(void)applicationDidFinishLaunching{
    [Parse enableLocalDatastore];
    [Parse setApplicationId:@"AppID" clientKey:@"Key"];
}

@parse-github-bot
Copy link

This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback.

@parse-github-bot
Copy link

We are closing this issue due to another 7 days of inactivity. If you have additional information to help pinpoint this issue as an SDK bug, please reopen it with the additional information.Thank you for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants