parse-community / ParseLiveQuery-iOS-OSX

Parse LiveQuery Client for iOS/OS X.
https://parseplatform.org
Other
192 stars 133 forks source link

Receiver type 'PFLiveQueryEvent' for instance message is a forward declaration (Xcode 12 Beta 6 / Objective-C project) #230

Closed ephread closed 3 years ago

ephread commented 4 years ago

I'm having a rather strange issue. I'm not certain it's an problem with ParseLiveQuery, but before opening a radar I'd like to know if I'm the only one having the issue (I didn't find any reports matching the problem on OpenRadar).

On Xcode 12 beta 6, any time a PFLiveQueryEvent instance is accessed, the compiler is complaining. I think it extends to other types as well.

Screen Shot 2020-09-15 at 20 37 10

I investigated a bit and can't see anything wrong in the codebase. Maybe someone will have better luck.

Here is a demo project, it's just the repo with all the dependencies pre-downloaded, Parse patched with parse-community/Parse-SDK-iOS-OSX#1527 and a couple of lines added to the example project. Just open Examples/LiveQueryDemo-ObjC.xcodeproj and try to build the macOS App. It should trigger the error right away. It's a bit big, so it's available here.

Thanks for your help!

Edit: Xcode 12 GM just dropped, I'm going to check if the issue is still present. Edit 2: Still happening with the GM, sadly.

akmarinov commented 4 years ago

Xcode 11 converts the PFLvieQueryEvent to:

/// Represents an update on a specific object from the live query server.
SWIFT_CLASS_NAMED("Event")
@interface PFLiveQueryEvent : NSObject
/// Type of the event.
@property (nonatomic, readonly) enum PFLiveQueryEventType type;
/// Object this event is for.
@property (nonatomic, readonly, strong) PFObject * _Nonnull object;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end

where Xcode 12 does just

@class PFLiveQueryEvent;

It feels like Apple has changed how code is converted and the ObjCCompat will have to be rewritten to be made exposable.

ephread commented 4 years ago

Following up on @akmarinov investigations, I tried multiple code permutations but I couldn't find a sensible reason explaining why PFLiveQueryEvent wouldn't be generated while PFLiveQuerySubscription is.

I tried to remove exposed properties, add new exposed methods, rename the class, shuffle code around, and so on… nothing seems to have any effect. Moving Event outside of ObjCCompat and renaming it does however solve the problem, at the cost of increasing the global namespace pollution.

It looks like a weird compiler bug, so I'm going to open a radar.

vexelgray commented 4 years ago

Hey @ephread!

Any news about this issue?

Regards,

akmarinov commented 4 years ago

@vexelgray you can use @ephread 's workaround on this fork of the repo - https://github.com/combyne/ParseLiveQuery-iOS-OSX/commits/xcode-12

until it's addressed on the main repo.

pod 'ParseLiveQuery', :git => 'https://github.com/combyne/ParseLiveQuery-iOS-OSX.git',
                          :branch => 'xcode-12'
dplewis commented 3 years ago

@ephread Can you do a PR for this? Would love to include your fix for the community.

ephread commented 3 years ago

@dplewis Absolutely, no worries. I'll create the PR some time this week.