-
Notifications
You must be signed in to change notification settings - Fork 19
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
iOS PCL project using AdvancedTimer will not run on iPhone unless Debugging is enabled #5
Comments
You are right. It is fine with emulator, but it crashes on a device on release mode. I'll let you know. |
I am facing the same issue. I released the app for client testing & they were not even able to go to the second screen where timer was used. The instance of the timer is always null in release mode. |
I'm sorry I couldn't find time to fix that. |
No Sorry. I don't think this is nuget issue here. I forked your code, build locally in release mode & hooked the DLL thus generated in my code. All works fine as long as you are running the app in debug mode, it crashes the app in release mode. Same results. |
Try by directly adding code to your project instead of compiling and adding DLL. |
I implemented your code in my app (copied the interface & its implementation for IOS) & so far it seems like its working fine. Thanks |
Ran into same issue, implementing code directly seems to be working. Nice implementation. |
Is this still an issue? Or has it been fixed? |
It was fixed on the project but I am not sure if the fix is pushed here. |
I am using NuGet version 1.0.1.0. Is it fix in there? |
This issue is still happening for me. Integrating the code into my project didn't help. However, setting the IoS Build to Debugging Enabled didn't help. The downside is that it doubled the size of my IPA file. |
For some reason, advanced timer is not working for me on either iOS or Android. It works in one PCL class but not in another. Seems odd. |
@adrianknight89 you maybe experiencing the same problem as me, each time you call DependencyService.Get(); you get the same object back, so the first time it works great, however if you want to use it again elsewhere its already bound to the callback when you used it the first time you called it, so appears to not work. Looking into DependencyService it looks like its suited to more singleton model, where there is only a single instance returned, however timers you would expect to be able to create multiple objects. |
Actually don't have to use DependencyService at all can use any IOC container e.g. using Autofac which xamarin.forms uses, So on iOS/Android side call following to register :-
then on PCL side, you can use following code which will create a new object each time
|
I'm not sure my issue is the same as that above. I'm not even able to Although setting the iOS build with the debug option does work for me, On 23/02/2016, mannyvw [email protected] wrote:
|
@mannyvw You're correct that DependencyService always returns the same instance. However, I figured there is a way to return a new instance each time. Try:
|
I've been having the same issue with release mode, and a different issue where the timer would not re-init, so it only worked the first time. @rlingineni suggestion of integrating the code directly, fixed my issue with release mode. @adrianknight89 suggestion with the new instance, fixed the issue of the timer not re-initializing. Thanks guys! |
Can confirm this is still an issue. Works fine until you try and use it in release mode on a device. Will try integrating the code directly. Thanks for the implementation! Edit: worked fine by moving over the interface to the X.F PCL and the iOS and Android .cs files to their respective client projects. |
We ran in to this exact issue and have no resolution. Tested on several iOS devices, running >= 8.1
|
Only way i got it to work was include the code directly in project rather than use nuget package. N |
Also running into this. Took me forever to figure out the problem but thank you all for letting me know of a workaround. |
@TravyDale what did you do to fix the problem? I tried building from source and include the UnifiedIOS and Abstractions DLLs, but now I am getting this error....
Should I include anything else? Is there another timer available for Xamarin.Forms that allows of cancelling the timer before it's Elapsed event? That's the only reason I'm using this library. EDIT: Nevermind. I ripped the code out of the library and just put it directly into my app and it works fine. |
@eclipsed4utoo lol sorry for the delay in response. I see your EDIT and that is what I did and it works for me now too. |
Thanks all for posting the solution here, removing the nuget package and including the code directly into my project solved the issue for me. App successfully submitted to the app store :) |
Never thought that such a popular nuget package can have issue like this. I wasted my whole day on this issue. But thanks everyone for posting the solution. It worked for me after integrating the source code directly. |
Adding the untouched projects to the solution didn't worked either, You have to include the files directly in your current app. Sadly I wasted 2 hours with this looking at clueless ios logs =( anyway, it is what it is ... thanks guys |
An alternative solution to including the code directly into the iOS project is to simply include a dummy use of the AdvancedTimerImplementation class, so the linker does not blow away this class. For example, include the following class in the iOS project.
|
If anyone still maintains this project, adding the preserve attribute on the platform implementations should fix DLL issue.
|
Is this issue still persist with nuget package ? |
@shrimantNikate Yes issue still remains with the nuget package. |
@ufuf I have implemented nuget package in my ongoing project, but seems working correctly. Can you pls let me know how can i reproduce this issue ? |
@shrimantNikate I don't use this library anymore but others state that the app is working fine on debug mode but not working on release mode with the nuget package. |
@ErnieScott Your solution worked for me. I just added the
right after I registered the dependency. Thanks for the suggestion! |
I just uploaded https://www.nuget.org/packages/info.dmwilson.AdvancedTimer.Forms.Plugin/1.0.2-alpha5 which appears to resolve this issue. I just used TestFlight to test a Release build of my iOS app, and the crash did not happen anymore. Instead of using attributes to register the implementations with the Xamarin.Forms DependencyService, I just call DependencyService.Register() from the AdvancedTimerImplementation.Init() static method. If you try the updated NuGet package, please let me know how it goes.
P.S. I just noticed that I left the Preserve attribute on the iOS implementation. This was not intentional. At first, I tried decorating the Android and iOS implementations with the Preserve attribute as suggested by @swansca79, but the crash continued. And now I'm much too tired to remove the attribute, make a new AdvancedTimer build, make a new build of my app, submit new build to Apple, et cetera. 😪 |
@d-m-wilson I'm trying to use your fork. Can you explain what you mean by: What does that exactly look like? I'm assuming you are putting that in Do you have a sample repo of how you implemented your fork? Thanks for any tips. |
@ryanbuening I was describing the fix for this issue, which I implemented in my fork of the library. You can see those changes here: d-m-wilson@01182d8 No change to your app's code is needed beyond what is described in the README. Sorry, but I do not currently have sample code available. |
I have an app which uses a PCL and 2 platform specific projects for iOS and Android and makes use of the AdvancedTimers.
The android app works fine, but the iOS app will only work on a device with debugging enabled in the iOS Build options. If I comment out all the code associated with the AdvancedTimers then the app will work again.
The text was updated successfully, but these errors were encountered: