Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by fredpointzero · Jul 23, 2012 at 05:51 AM · iosgenericaot

How to use Reactive Extensions on iOS ?

Hi everyone,

I want to use the Reactive Extensions of Microsoft to use the Reactive Programming pattern. I imported the dll (at version 1.0, which is compatible with dotnet Framework 3.5) and it work perfectly on platform where JIT is available.

But, for iOS, the JIT compiler is not available and I ran into the error :

 Attempting to JIT compile method
 'System.Reactive.Concurrency.ScheduledItem`2<System.DateTimeOffset, System.Action>:.ctor(System.Reactive.Concurrency.IScheduler, System.Action, System.Func`3<System.Reactive.Concurrency.IScheduler, System.Action, System.IDisposable>, System.DateTimeOffset)' while running with --aot-only

The actual issue is that a generic method is called (`System.Reactive.Concurrency.ScheduledItem:.ctor`) with a value type as parameter (`System.DateTimeOffset` which is a struct) and such calls need to be generated by the JIT compiler

I tried several solutions, but they did not succeeded :

  1. I first wanted to for the aot compiler to include the required method. But, System.Reactive.Concurrency.ScheduledItem is not visible, so I can not reference the class.

  2. I tried to call the first visible method explicitly, but It provokes the same issue.

  3. I tried to use a custom IScheduler (which use the Unity's coroutine system to schedule items) that will not call the System.Reactive.Concurrency.CurrentThreadScheduler (the default scheduler that create the issue). In order to force the use of this scheduler, I called SubscribeOn and ObserveOn on all Subject I use as IObservable. But, the issue still happens on Subscribe call.

  4. I wanted to replace somehow the default IScheduler, but It seems not possible to replace it. Anyway, I did not find a way to do it.

  5. I planned to implement myself a subset of Rx features which would be simple and synchronous. But, it is a loss of time to reproduce a framework that already exists and was done by an entire team of Microsoft.

Currently, my plan is to create my own implementation. Well, this is not a good solution, but I did not find another way. Moreover, it raise another issue : How to choose a dll in the Assets folder depending on the platform selected ? (ie : I want to use Microsoft's dll for jit platform and my implementation for aot platforms)

Well, I am a kind of stuck here, any idea will be greatly appreciated !

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Wiki

Answer by JaredThirsk · Oct 22, 2013 at 05:49 AM

This discussion suggests that the outdated version of Mono that Unity3D uses (2.6) has problems with Rx: https://rx.codeplex.com/discussions/406013

Also, there are known issues with older (and newer?) versions of mono and generic interfaces on AOT (for iOS.)

Also, there are issues with older versions of mono and structs in generic interfaces. I would try wrapping DateTimeOffset in a class (reference type.) I believe this has been addressed in the latest versions of mono.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Saving Data on IOS produces JIT Error in Xcode 2 Answers

Failed to load AOT module 'mscorlib' while running in aot-only mode 0 Answers

Loading scripts dynamically in AoT compilers 1 Answer

Is it possible to use LUA or JS to bypass AOT limitations on iOS? 1 Answer

iOS JIT compile error on Generic method called with basic types (int, bool, float) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges