Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Error while using Legacy Image Effect in IOS project

Discussion in 'Image Effects' started by rxvincent, Jul 27, 2018.

  1. rxvincent

    rxvincent

    Joined:
    Sep 12, 2017
    Posts:
    1
    Hello everyone, I use the Mobile Bloom, which is from the legacy image effect in my IOS project and I use Metal as Graphic API. Some error occurred like that

    This is what my Xcode console show
    Code (CSharp):
    1. Compilation failed:
    2.  
    3. program_source:48:28: error: no member named 'TEXCOORD2' in 'Mtl_FragmentIn'; did you mean 'TEXCOORD1'?
    4. phase0_Input0_2[1] = input.TEXCOORD2;
    5.                            ^~~~~~~~~
    6.                            TEXCOORD1
    7. program_source:26:11: note: 'TEXCOORD1' declared here
    8.     half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    9.           ^
    10. program_source:49:28: error: no member named 'TEXCOORD3' in 'Mtl_FragmentIn'; did you mean 'TEXCOORD1'?
    11. phase0_Input0_2[2] = input.TEXCOORD3;
    12.                            ^~~~~~~~~
    13.                            TEXCOORD1
    14. program_source:26:11: note: 'TEXCOORD1' declared here
    15.     half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    16.           ^
    17.  
    18.  
    19.  
    20. #include <metal_stdlib>
    21. #include <metal_texture>
    22. using namespace metal;
    23. #if !(__HAVE_FMA__)
    24. #define fma(a,b,c) ((a) * (b) + (c))
    25. #endif
    26. constant float4 ImmCB_0[7] =
    27. {
    28.     float4(0.0205000006, 0.0, 0.0, 0.0),
    29.     float4(0.0855000019, 0.0, 0.0, 0.0),
    30.     float4(0.231999993, 0.0, 0.0, 0.0),
    31.     float4(0.324000001, 0.0, 0.0, 1.0),
    32.     float4(0.231999993, 0.0, 0.0, 0.0),
    33.     float4(0.0855000019, 0.0, 0.0, 0.0),
    34.     float4(0.0205000006, 0.0, 0.0, 0.0)
    35. };
    36. #ifndef XLT_REMAP_O
    37.     #define XLT_REMAP_O {0, 1, 2, 3, 4, 5, 6, 7}
    38. #endif
    39. constexpr constant uint xlt_remap_o[] = XLT_REMAP_O;
    40. struct Mtl_FragmentIn
    41. {
    42.     half2 TEXCOORD0 [[ user(TEXCOORD0) ]] ;
    43.     half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    44. };
    45. struct Mtl_FragmentOut
    46. {
    47.     half4 SV_Target0 [[ color(xlt_remap_o[0]) ]];
    48. };
    49. fragment Mtl_FragmentOut xlatMtlMain(
    50.     sampler sampler_MainTex [[ sampler (0) ]],
    51.     texture2d<half, access::sample > _MainTex [[ texture(0) ]] ,
    52.     Mtl_FragmentIn input [[ stage_in ]])
    53. {
    54.     Mtl_FragmentOut output;
    55.     half4 u_xlat16_0;
    56.     half4 u_xlat16_1;
    57.     int u_xlati2;
    58.     half4 u_xlat16_3;
    59.     half4 u_xlat16_4;
    60.     bool u_xlatb7;
    61. half4 phase0_Input0_2[3];
    62. phase0_Input0_2[0] = input.TEXCOORD1;
    63. phase0_Input0_2[1] = input.TEXCOORD2;
    64. phase0_Input0_2[2] = input.TEXCOORD3;
    65.     u_xlat16_0 = _MainTex.sample(sampler_MainTex, float2(input.TEXCOORD0.xy));
    66.     u_xlat16_0 = u_xlat16_0 * half4(0.324000001, 0.324000001, 0.324000001, 1.0);
    67.     u_xlat16_1 = u_xlat16_0;
    68.     u_xlati2 = 0x0;
    69.     while(true){
    70.         u_xlatb7 = u_xlati2>=0x3;
    71.         if(u_xlatb7){break;}
    72.         u_xlat16_3 = _MainTex.sample(sampler_MainTex, float2(phase0_Input0_2[u_xlati2].xy));
    73.         u_xlat16_4 = _MainTex.sample(sampler_MainTex, float2(phase0_Input0_2[u_xlati2].zw));
    74.         u_xlat16_3 = u_xlat16_3 + u_xlat16_4;
    75.         u_xlat16_1 = fma(u_xlat16_3, half4(ImmCB_0[u_xlati2].xxxw), u_xlat16_1);
    76.         u_xlati2 = u_xlati2 + 0x1;
    77.     }
    78.     output.SV_Target0 = u_xlat16_1;
    79.     return output;
    80. }
    81. Compilation failed:
    82.  
    83. program_source:48:28: error: no member named 'TEXCOORD2' in 'Mtl_FragmentIn'; did you mean 'TEXCOORD1'?
    84. phase0_Input0_2[1] = input.TEXCOORD2;
    85.                            ^~~~~~~~~
    86.                            TEXCOORD1
    87. program_source:26:11: note: 'TEXCOORD1' declared here
    88.     half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    89.           ^
    90. program_source:49:28: error: no member named 'TEXCOORD3' in 'Mtl_FragmentIn'; did you mean 'TEXCOORD1'?
    91. phase0_Input0_2[2] = input.TEXCOORD3;
    92.                            ^~~~~~~~~
    93.                            TEXCOORD1
    94. program_source:26:11: note: 'TEXCOORD1' declared here
    95.     half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    96.           ^
    97.  
    98.  
    99.  
    100. #include <metal_stdlib>
    101. #include <metal_texture>
    102. using namespace metal;
    103. #if !(__HAVE_FMA__)
    104. #define fma(a,b,c) ((a) * (b) + (c))
    105. #endif
    106. constant float4 ImmCB_0[7] =
    107. {
    108.     float4(0.0205000006, 0.0, 0.0, 0.0),
    109.     float4(0.0855000019, 0.0, 0.0, 0.0),
    110.     float4(0.231999993, 0.0, 0.0, 0.0),
    111.     float4(0.324000001, 0.0, 0.0, 1.0),
    112.     float4(0.231999993, 0.0, 0.0, 0.0),
    113.     float4(0.0855000019, 0.0, 0.0, 0.0),
    114.     float4(0.0205000006, 0.0, 0.0, 0.0)
    115. };
    116. #ifndef XLT_REMAP_O
    117.     #define XLT_REMAP_O {0, 1, 2, 3, 4, 5, 6, 7}
    118. #endif
    119. constexpr constant uint xlt_remap_o[] = XLT_REMAP_O;
    120. struct Mtl_FragmentIn
    121. {
    122.     half2 TEXCOORD0 [[ user(TEXCOORD0) ]] ;
    123.     half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    124. };
    125. struct Mtl_FragmentOut
    126. {
    127.     half4 SV_Target0 [[ color(xlt_remap_o[0]) ]];
    128. };
    129. fragment Mtl_FragmentOut xlatMtlMain(
    130.     sampler sampler_MainTex [[ sampler (0) ]],
    131.     texture2d<half, access::sample > _MainTex [[ texture(0) ]] ,
    132.     Mtl_FragmentIn input [[ stage_in ]])
    133. {
    134.     Mtl_FragmentOut output;
    135.     half4 u_xlat16_0;
    136.     half4 u_xlat16_1;
    137.     int u_xlati2;
    138.     half4 u_xlat16_3;
    139.     half4 u_xlat16_4;
    140.     bool u_xlatb7;
    141. half4 phase0_Input0_2[3];
    142. phase0_Input0_2[0] = input.TEXCOORD1;
    143. phase0_Input0_2[1] = input.TEXCOORD2;
    144. phase0_Input0_2[2] = input.TEXCOORD3;
    145.     u_xlat16_0 = _MainTex.sample(sampler_MainTex, float2(input.TEXCOORD0.xy));
    146.     u_xlat16_0 = u_xlat16_0 * half4(0.324000001, 0.324000001, 0.324000001, 1.0);
    147.     u_xlat16_1 = u_xlat16_0;
    148.     u_xlati2 = 0x0;
    149.     while(true){
    150.         u_xlatb7 = u_xlati2>=0x3;
    151.         if(u_xlatb7){break;}
    152.         u_xlat16_3 = _MainTex.sample(sampler_MainTex, float2(phase0_Input0_2[u_xlati2].xy));
    153.         u_xlat16_4 = _MainTex.sample(sampler_MainTex, float2(phase0_Input0_2[u_xlati2].zw));
    154.         u_xlat16_3 = u_xlat16_3 + u_xlat16_4;
    155.         u_xlat16_1 = fma(u_xlat16_3, half4(ImmCB_0[u_xlati2].xxxw), u_xlat16_1);
    156.         u_xlati2 = u_xlati2 + 0x1;
    157.     }
    158.     output.SV_Target0 = u_xlat16_1;
    159.     return output;
    160. }
    161. WARNING: Shader Unsupported: 'Hidden/FastBloom' - Pass '' has no fragment shader
    162. WARNING: Shader Unsupported: 'Hidden/FastBloom' - Setting to default shader.
    163. The shader Hidden/FastBloom (UnityEngine.Shader) on effect Camera (UnityStandardAssets.ImageEffects.BloomOptimized) is not supported on this platform!
    164. UnityStandardAssets.ImageEffects.PostEffectsBase:CheckShaderAndCreateMaterial(Shader, Material)
    165. UnityStandardAssets.ImageEffects.BloomOptimized:CheckResources()
    166. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    167.  
    168. The image effect Camera (UnityStandardAssets.ImageEffects.BloomOptimized) has been disabled as it's not supported on the current platform.
    169. UnityStandardAssets.ImageEffects.BloomOptimized:CheckResources()
    170. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    171.  
    172. Upload103 code=ad_full_trigger, obj=, entrance=4, tab=0
    173. AppUtils:Upload103(String, String, String, Int32)
    174. AdManager:ShowFullScreenAd(Int32, FULLSCREEN_ENTRANCE)
    175. VoxelGameMain:OnHide()
    176. LayerManager:OnEnterAnimationEnd(UIAnimation)
    177. LayerManager:PushLayer(String, Boolean, Message)
    178. VoxelGameMain:OnClick(GameObject)
    179. KeyFrameAnimation:Animate(Single)
    180. UIAnimationManager:Update()
    181. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    182.  
    183. NatCorder: Initialized NatCorder 1.2 iOS backend
    184. NatCorderU.Core.NatCorder:.cctor()
    185. NatCorderU.Core.Replay:get_IsRecording()
    186. RecorderHelper:StopRecording()
    187. VoxelGameMain:OnHide()
    188. LayerManager:OnEnterAnimationEnd(UIAnimation)
    189. LayerManager:PushLayer(String, Boolean, Message)
    190. VoxelGameMain:OnClick(GameObject)
    191. KeyFrameAnimation:Animate(Single)
    192. UIAnimationManager:Update()
    193. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    194.  
    195. Unloading 5 Unused Serialized files (Serialized files now loaded: 0)
    196. System memory in use before: 30.5 MB.
    197. System memory in use after: 31.1 MB.
    198.  
    199. Unloading 151 unused Assets to reduce memory usage. Loaded Objects now: 12384.
    200. Total: 22.870875 ms (FindLiveObjects: 3.054000 ms CreateObjectMapping: 0.274291 ms MarkObjects: 19.126625 ms  DeleteObjects: 0.414750 ms)
    201.  
    202. Upload103 code=ad_full_trigger, obj=, entrance=5, tab=0
    203. AppUtils:Upload103(String, String, String, Int32)
    204. AdManager:ShowFullScreenAd(Int32, FULLSCREEN_ENTRANCE)
    205. UIModelBase:Go2Game(Int32)
    206. KeyFrameAnimation:Animate(Single)
    207. UIAnimationManager:Update()
    208. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    209.  
    210. Compilation failed:
    211.  
    212. program_source:56:28: error: no member named 'TEXCOORD2' in 'Mtl_FragmentIn'; did you mean 'TEXCOORD1'?
    213. phase0_Input0_2[1] = input.TEXCOORD2;
    214.                           ^~~~~~~~~
    215.                           TEXCOORD1
    216. program_source:31:11: note: 'TEXCOORD1' declared here
    217.    half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    218.          ^
    219. program_source:57:28: error: no member named 'TEXCOORD3' in 'Mtl_FragmentIn'; did you mean 'TEXCOORD1'?
    220. phase0_Input0_2[2] = input.TEXCOORD3;
    221.                           ^~~~~~~~~
    222.                           TEXCOORD1
    223. program_source:31:11: note: 'TEXCOORD1' declared here
    224.    half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    225.          ^
    226.  
    227.  
    228.  
    229. #include <metal_stdlib>
    230. #include <metal_texture>
    231. using namespace metal;
    232. #if !(__HAVE_FMA__)
    233. #define fma(a,b,c) ((a) * (b) + (c))
    234. #endif
    235. constant float4 ImmCB_0[7] =
    236. {
    237.    float4(0.0205000006, 0.0, 0.0, 0.0),
    238.    float4(0.0855000019, 0.0, 0.0, 0.0),
    239.    float4(0.231999993, 0.0, 0.0, 0.0),
    240.    float4(0.324000001, 0.0, 0.0, 1.0),
    241.  
    242.    float4(0.231999993, 0.0, 0.0, 0.0),
    243.    float4(0.0855000019, 0.0, 0.0, 0.0),
    244.    float4(0.0205000006, 0.0, 0.0, 0.0)
    245. };
    246. #ifndef XLT_REMAP_O
    247.    #define XLT_REMAP_O {0, 1, 2, 3, 4, 5, 6, 7}
    248. #endif
    249. constexpr constant uint xlt_remap_o[] = XLT_REMAP_O;
    250. struct FGlobals_Type
    251. {
    252.    half4 _MainTex_ST;
    253. };
    254. struct Mtl_FragmentIn
    255. {
    256.    half2 TEXCOORD0 [[ user(TEXCOORD0) ]] ;
    257.    half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    258. };
    259. struct Mtl_FragmentOut
    260. {
    261.    half4 SV_Target0 [[ color(xlt_remap_o[0]) ]];
    262. };
    263. fragment Mtl_FragmentOut xlatMtlMain(
    264.    constant FGlobals_Type& FGlobals [[ buffer(0) ]],
    265.    sampler sampler_MainTex [[ sampler (0) ]],
    266.    texture2d<half, access::sample > _MainTex [[ texture(0) ]] ,
    267.    Mtl_FragmentIn input [[ stage_in ]])
    268. {
    269.    Mtl_FragmentOut output;
    270.    float2 u_xlat0;
    271.    half4 u_xlat16_0;
    272.    half4 u_xlat16_1;
    273.    int u_xlati2;
    274.    float4 u_xlat3;
    275.    half4 u_xlat16_3;
    276.    half4 u_xlat16_4;
    277.    bool u_xlatb7;
    278. half4 phase0_Input0_2[3];
    279. phase0_Input0_2[0] = input.TEXCOORD1;
    280. phase0_Input0_2[1] = input.TEXCOORD2;
    281. phase0_Input0_2[2] = input.TEXCOORD3;
    282.    u_xlat0.xy = fma(float2(input.TEXCOORD0.xy), float2(FGlobals._MainTex_ST.xy), float2(FGlobals._MainTex_ST.zw));
    283.    u_xlat16_0 = _MainTex.sample(sampler_MainTex, u_xlat0.xy);
    284.    u_xlat16_0 = u_xlat16_0 * half4(0.324000001, 0.324000001, 0.324000001, 1.0);
    285.    u_xlat16_1 = u_xlat16_0;
    286.    u_xlati2 = 0x0;
    287.    while(true){
    288.        u_xlatb7 = u_xlati2>=0x3;
    289.        if(u_xlatb7){break;}
    290.        u_xlat3 = fma(float4(phase0_Input0_2[u_xlati2]), float4(FGlobals._MainTex_ST.xyxy), float4(FGlobals._MainTex_ST.zwzw));
    291.        u_xlat16_4 = _MainTex.sample(sampler_MainTex, u_xlat3.xy);
    292.        u_xlat16_3 = _MainTex.sample(sampler_MainTex, u_xlat3.zw);
    293.        u_xlat16_3 = u_xlat16_3 + u_xlat16_4;
    294.        u_xlat16_1 = fma(u_xlat16_3, half4(ImmCB_0[u_xlati2].xxxw), u_xlat16_1);
    295.        u_xlati2 = u_xlati2 + 0x1;
    296.    }
    297.    output.SV_Target0 = u_xlat16_1;
    298.    return output;
    299. }
    300. Compilation failed:
    301.  
    302. program_source:56:28: error: no member named 'TEXCOORD2' in 'Mtl_FragmentIn'; did you mean 'TEXCOORD1'?
    303. phase0_Input0_2[1] = input.TEXCOORD2;
    304.                           ^~~~~~~~~
    305.                           TEXCOORD1
    306. program_source:31:11: note: 'TEXCOORD1' declared here
    307.    half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    308.          ^
    309. program_source:57:28: error: no member named 'TEXCOORD3' in 'Mtl_FragmentIn'; did you mean 'TEXCOORD1'?
    310. phase0_Input0_2[2] = input.TEXCOORD3;
    311.                           ^~~~~~~~~
    312.                           TEXCOORD1
    313. program_source:31:11: note: 'TEXCOORD1' declared here
    314.    half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    315.          ^
    316.  
    317.  
    318.  
    319. #include <metal_stdlib>
    320. #include <metal_texture>
    321. using namespace metal;
    322. #if !(__HAVE_FMA__)
    323. #define fma(a,b,c) ((a) * (b) + (c))
    324. #endif
    325. constant float4 ImmCB_0[7] =
    326. {
    327.    float4(0.0205000006, 0.0, 0.0, 0.0),
    328.    float4(0.0855000019, 0.0, 0.0, 0.0),
    329.    float4(0.231999993, 0.0, 0.0, 0.0),
    330.    float4(0.324000001, 0.0, 0.0, 1.0),
    331.  
    332.    float4(0.231999993, 0.0, 0.0, 0.0),
    333.    float4(0.0855000019, 0.0, 0.0, 0.0),
    334.    float4(0.0205000006, 0.0, 0.0, 0.0)
    335. };
    336. #ifndef XLT_REMAP_O
    337.    #define XLT_REMAP_O {0, 1, 2, 3, 4, 5, 6, 7}
    338. #endif
    339. constexpr constant uint xlt_remap_o[] = XLT_REMAP_O;
    340. struct FGlobals_Type
    341. {
    342.    half4 _MainTex_ST;
    343. };
    344. struct Mtl_FragmentIn
    345. {
    346.    half2 TEXCOORD0 [[ user(TEXCOORD0) ]] ;
    347.    half4 TEXCOORD1 [[ user(TEXCOORD1) ]] ;
    348. };
    349. struct Mtl_FragmentOut
    350. {
    351.    half4 SV_Target0 [[ color(xlt_remap_o[0]) ]];
    352. };
    353. fragment Mtl_FragmentOut xlatMtlMain(
    354.    constant FGlobals_Type& FGlobals [[ buffer(0) ]],
    355.    sampler sampler_MainTex [[ sampler (0) ]],
    356.    texture2d<half, access::sample > _MainTex [[ texture(0) ]] ,
    357.    Mtl_FragmentIn input [[ stage_in ]])
    358. {
    359.    Mtl_FragmentOut output;
    360.    float2 u_xlat0;
    361.    half4 u_xlat16_0;
    362.    half4 u_xlat16_1;
    363.    int u_xlati2;
    364.    float4 u_xlat3;
    365.    half4 u_xlat16_3;
    366.    half4 u_xlat16_4;
    367.    bool u_xlatb7;
    368. half4 phase0_Input0_2[3];
    369. phase0_Input0_2[0] = input.TEXCOORD1;
    370.  
    371. phase0_Input0_2[1] = input.TEXCOORD2;
    372. phase0_Input0_2[2] = input.TEXCOORD3;
    373.    u_xlat0.xy = fma(float2(input.TEXCOORD0.xy), float2(FGlobals._MainTex_ST.xy), float2(FGlobals._MainTex_ST.zw));
    374.    u_xlat16_0 = _MainTex.sample(sampler_MainTex, u_xlat0.xy);
    375.    u_xlat16_0 = u_xlat16_0 * half4(0.324000001, 0.324000001, 0.324000001, 1.0);
    376.    u_xlat16_1 = u_xlat16_0;
    377.    u_xlati2 = 0x0;
    378.    while(true){
    379.        u_xlatb7 = u_xlati2>=0x3;
    380.        if(u_xlatb7){break;}
    381.        u_xlat3 = fma(float4(phase0_Input0_2[u_xlati2]), float4(FGlobals._MainTex_ST.xyxy), float4(FGlobals._MainTex_ST.zwzw));
    382.        u_xlat16_4 = _MainTex.sample(sampler_MainTex, u_xlat3.xy);
    383.        u_xlat16_3 = _MainTex.sample(sampler_MainTex, u_xlat3.zw);
    384.        u_xlat16_3 = u_xlat16_3 + u_xlat16_4;
    385.        u_xlat16_1 = fma(u_xlat16_3, half4(ImmCB_0[u_xlati2].xxxw), u_xlat16_1);
    386.        u_xlati2 = u_xlati2 + 0x1;
    387.    }
    388.    output.SV_Target0 = u_xlat16_1;
    389.    return output;
    390. }
    391. WARNING: Shader Unsupported: 'Hidden/FastBloom' - Pass '' has no fragment shader
    392. WARNING: Shader Unsupported: 'Hidden/FastBloom' - Setting to default shader.

    Here I had use another shader call FasterBloom, but it still not work, so as the standard one.
    I have read lots of thread and really have no idea. Please help me.
     
  2. BearHugMark

    BearHugMark

    Joined:
    Feb 21, 2016
    Posts:
    21
    I have exactly the same issue sadly. Did you ever manage to fix it?

    Shader used to work fine on iOS with Metal, and I upgraded unity from 2017 to 2018 and it no longer works.

    TexCoord2 and 3 don't seem to get defined even though they should be, it appears.
     
  3. BearHugMark

    BearHugMark

    Joined:
    Feb 21, 2016
    Posts:
    21
    Just fixed it in one of the shaders.

    The problem is this struct:
    struct v2f_withBlurCoordsSGX
    {
    float4 pos : SV_POSITION;
    half2 uv : TEXCOORD0;
    half4 offs[3] : TEXCOORD1;
    };

    specifically half4 offs[3] : TEXCOORD1;

    The compiled shader doesn't realise that it should also be using TEXCOORD2 and TEXCOORD3

    I changed it to this (and fixed up the references):
    struct v2f_withBlurCoordsSGX
    {
    float4 pos : SV_POSITION;
    half2 uv : TEXCOORD0;
    half4 offs0 : TEXCOORD1;
    half4 offs1 : TEXCOORD2;
    half4 offs2 : TEXCOORD3;

    };

    and now it compiles fine on iOS. I just need to do the same for the other shaders. Maybe an optimisation or assumption gone wrong in the shader compiler?
     
    country_dragon and BlackBindy like this.
  4. BlackBindy

    BlackBindy

    Joined:
    May 9, 2015
    Posts:
    4
    OH MY GOSH
    You have saved my life. Thank you so much :(

    I've suffered from the same issue on BloomOptimized image effect (specifically, FastBloom shader)
    I replaced 'offs' array to multiple individual 'off's as you said, and now it works so well on iPhone.