Comments (10)
Alright, I think I found a solution.
I tried to migrate the ios part to swift before but it would not find the background_locator module and therefore not build.
But then I noticed those lines where missing in my Podfile:
target 'Runner' do
use_frameworks! <-- this one
use_modular_headers! <-- and this one
# Flutter Pod
copied_flutter_dir = File.join(__dir__, 'Flutter')
After adding those and running pod install the Pods_Runner.framework is used in the libs section and things are loaded properly.
from background_locator.
You have Objective-C project, There is no need to add AppDelagate.swift
. Just add the following line to your AppDelegate.m
file:
#import <background_locator/BackgroundLocatorPlugin.h>
from background_locator.
The ios part has been generated when I first started the project and I have no knowledge about it. Maybe previous Object-C were generated instead of Swift.
Anyways your suggestion worked: I placed it in the .h just because there I found imports while the .m had includes. But it should be the same I guess.
Thanks a lot!
from background_locator.
Please allow me to reopen this, since it looks related.
On IOS the app crashes at startup when trying to connect. In the crash log I find only this which seems to be related:
Thread 0 name:
Thread 0 Crashed:
0 ??? 000000000000000000 0 + 0
1 Runner 0x000000010037e440 -[BackgroundLocatorPlugin handleMethodCall:result:] + 248
2 Flutter 0x000000010087ad20 0x1007ec000 + 584992
3 Flutter 0x0000000100818338 0x1007ec000 + 181048
4 Flutter 0x000000010086bd5c 0x1007ec000 + 523612
5 Flutter 0x0000000100826f58 0x1007ec000 + 241496
6 Flutter 0x00000001008291dc 0x1007ec000 + 250332
7 CoreFoundation 0x00000001ba9b61c0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28 (CFRunLoop.c:1766)
8 CoreFoundation 0x00000001ba9b5edc __CFRunLoopDoTimer + 880 (CFRunLoop.c:2357)
9 CoreFoundation 0x00000001ba9b55b8 __CFRunLoopDoTimers + 276 (CFRunLoop.c:2512)
10 CoreFoundation 0x00000001ba9b05c8 __CFRunLoopRun + 1640 (CFRunLoop.c:0)
11 CoreFoundation 0x00000001ba9afc34 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3192)
12 GraphicsServices 0x00000001c4af938c GSEventRunModal + 160 (GSEvent.c:2246)
13 UIKitCore 0x00000001beae222c UIApplicationMain + 1932 (UIApplication.m:4820)
14 Runner 0x00000001003753a8 main + 88
15 libdyld.dylib 0x00000001ba837800 start + 4
I am quite sure I followed the instructions properly, but clearly something is off. DO you see something that might lead me to the error? Thanks a ton.
from background_locator.
Are you running the project "example" inside this repository or is it a new application that you copied the configuration?
from background_locator.
@gpibarra it is a different application inside which I am trying to use the library.
update: I have been able to successfully install the example project and run. The only difference I see is the nature of the ios part (swift vs object-c). I will investigate. Thanks for the hint.
from background_locator.
Alright, finally been able to run my app throught Xcode on a device. I am getting this:
.pub-cache/hosted/pub.dartlang.org/background_locator-1.1.2+2/ios/Classes/BackgroundLocatorPlugin.m:169
2020-04-28 09:09:13.539639+0200 Runner[361:15753] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'failed to set registerPlugins'
So I assume I am just doing something wrong in the object-c code. Since I have no idea about what I am doing in there, I will try to post my files, since I feel something is missing:
main.m
#import <Flutter/Flutter.h>
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char* argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
AppDelegate.h
#import <Flutter/Flutter.h>
#import <UIKit/UIKit.h>
@interface AppDelegate : FlutterAppDelegate
@end
AppDelegate.m
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import <background_locator/BackgroundLocatorPlugin.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customisation after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
Shouldn't I be able to call: BackgroundLocatorPlugin.setPluginRegistrantCallback(registerPlugins)
in here somehow?
from background_locator.
If it is of interest, I could write a small entry about this migration in the wiki setup part. Maybe another complete ignorant in ios as myself could find benefit.
from background_locator.
If it is of interest, I could write a small entry about this migration in the wiki setup part. Maybe another complete ignorant in ios as myself could find benefit.
You are very welcome to do that;
from background_locator.
It is the least I can do :-)
I just noticed that there is no way to make pull requests against the wiki. I therefore attach my proposal of the setup file (zipped sine github doesn't allow md file to be uploaded):Setup.md.zip
For better readability I inverted the steps. It should not be a problem, but you better check if things look right.
Thanks!
from background_locator.
Related Issues (20)
- How can I send data from location callback to controller? HOT 1
- location_callback_handler.dart not found when run release project HOT 5
- [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:untitled/location_callback_handler.dart' not found. HOT 4
- Unable to build flutter release version with background_locator lastest HOT 1
- Library Update
- Issue on release build HOT 8
- Unable to capture location in release mode (Android) HOT 4
- Unable to run on iOS
- Error java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient HOT 1
- Error on init app flutter with carp_background_location HOT 5
- java.lang.IncompatibleClassChangeError: The method 'com.google.android.gms.tasks.Task com.google.android.gms.location.FusedLocationProviderClient.requestLocationUpdates(com.google.android.gms.location.LocationRequest, com.google.android.gms.location.LocationCallback, android.os.Looper)' was expected to be of type virtual but instead was found to be of type interface (declaration of 'rekab.app.background_locator.provider.GoogleLocationProviderClient' appears in /data/app/com.doa.lojisoft.saray-JqLCd0a12SEpAYQu6cUZjg==/base.apk:classes2.dex) HOT 2
- Service stopped suddenly in release mode android
- Data type mismatch (nullable type) and method implementation error in kotlin code just after adding the dependency HOT 1
- [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument: is a regular instance: Instance of 'LocationDto'
- What is speed measured in?
- How to stop service after a period of time?
- Upgrade Background_Locator
- Need Code or Library in kotlin only
- I so confused about "getting location updates even when the app is killed" !!!!
- Is it still maintained? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from background_locator.