Closed Piets closed 3 years ago
+1
Yes of course we will add that. We have a lot of people requesting it, including ourselves for internal projects! It will come in a future release. It is not 100% straight forward though since Apple have as of relatively late removed support for Bluetooth LE in the simulator environment. So we have to add pre-processor macros and stuff to solve it. Not a big deal, but still work that has to be done :P Thanks for reporting it! Let us know if you have any other requests.
+2
also a continued request for third party SDK so that we're not dependent on the flic app to add BT buttons
The problem though, as I remember it from when I looked at this before, is that you can not submit to App Store when using a framework that has slices for both iOS and simulator. This would mean that the developer would have to manually remove the simulator slices again before submitting, which seems a bit annoying.
You don't happen to know anything about this?
Okay, this indeed seems like a real problem. According to this article this problem still exists in modern Xcode versions. So the solution might be to provide a fat framework (for the device and the simulator) and then provide a guide for developers to install those Run Script phases to strip the Simulator slices on a device release build. I know that this has the drawback of complicating the setup process. One alternative I could think of would probably be to provide a static library? The last time I checked on that fat frameworks weren't a problem for AppStore submission.
I've worked around this by adding the following to my abstraction of how I interact with the Flic:
#if TARGET_IPHONE_SIMULATOR
@implementation SCLFlicManager
- (instancetype)initWithDelegate:(id <SCLFlicManagerDelegate> _Nonnull)delegate
appID:(NSString *_Nonnull)appID
appSecret:(NSString *_Nonnull)appSecret
backgroundExecution:(BOOL)bExecution
andRestoreState:(BOOL)restore
{
self = [super init];
return self;
}
- (NSDictionary<NSUUID *, SCLFlicButton *> *_Nonnull)knownButtons
{
return @{};
}
- (void)forgetButton:(SCLFlicButton *_Nonnull)button
{
}
- (void)disable
{
}
- (void)enable
{
}
- (void)requestButtonFromFlicAppWithCallback:(NSString *_Nonnull)callback
{
[[SSFlicButtonManager sharedInstance] handleOpenURL:nil];
}
- (SCLFlicButton *_Nullable)generateButtonFromURL:(NSURL *_Nonnull)url
error:(NSError *_Nullable *_Nullable)error
{
SCLFlicButton *button = [[SCLFlicButton alloc] init];
return button;
}
- (void)refreshPendingConnections
{
}
@end
@interface SCLFlicButton ()
@property (assign, getter=isFakeConnected) BOOL fakeConnected;
@end
@implementation SCLFlicButton
- (NSUUID *)buttonIdentifier
{
return [NSUUID UUID];
}
- (void)connect
{
self.fakeConnected = YES;
}
- (void)disconnect
{
self.fakeConnected = NO;
}
- (void)indicateLED:(SCLFlicButtonLEDIndicateCount)count
{
}
- (void)setMode:(SCLFlicButtonMode)mode
{
}
- (void)readRSSI
{
}
- (SCLFlicButtonConnectionState)connectionState
{
if (self.fakeConnected) {
return SCLFlicButtonConnectionStateConnected;
} else {
return SCLFlicButtonConnectionStateDisconnected;
}
}
@end
#endif
Any further work on this issue?
Please add slices for the iOS Simulator to the framework. As of now it is not possible to even build a project for the simulator as it fails during linking. I completely understand that functionality would be limited on the simulator, but even if the framework would do nothing it would be a great improvement over the current situation.
For information on how to achieve such a universal framework (with slices for the various iOS and Simulator architectures check out this article, this post on the developer forums and last but not least this script