12 Replies
      Latest reply on Dec 11, 2019 7:37 AM by john daniel
      john daniel Level 4 Level 4 (550 points)

        I have an older phone that I would like to use for testing. It is an iPhone 6s running iOS 11.4.1

         

        I can run my app on the device, but I can't run any unit tests. When I try, I get the following error:

         

        dyld: could not load inserted library '__PLATFORMS__/iPhoneOS.platform/Developer/usr/lib/libXCTestBundleInject.dylib' because image not found

         

        If I try the exact same thing on my new iPhone 11 Pro running iOS 13.2.3, I get the same error, but the tests work fine.

         

        I've only seen this problem definitively referenced one other place: github.com/CocoaPods/CocoaPods/issues/9165

         

        I tried added "-weak_framework XCTEST -weak-lXCTestSwiftSupport" to linker flags and "$(PLATFORM_DIR)/Developer/usr/lib" Library search path, but it didn't help. I tried cleaning the build folder, deletingn the previous app, and restarting the device. Same problem.

         

        I guess I should have upgraded to iOS 12 when I had the chance. I didn't expect to get blocked on something like this. I would like to have some backwards compatibility. Is there any other way to upgrade an iOS13-capable device to iOS 12? I think the iPhone 6 was one of the few that is only upgradeable to iOS 12. I might be able to find one of those. Any other suggestions?

        • Re: Cannot test on iOS 11 device
          KMT Level 9 Level 9 (15,425 points)

          Not sure you can get there from here on that 6s. I suspect if you try to update an otherwise compatible device from 11.x, Apple will only sign the most current iOS, that being 13.x, so yes, time to sniff out a 6, I think. I'm only sitting on a spare 6s+, tho, so can't help, sorry.

            • Re: Cannot test on iOS 11 device
              john daniel Level 4 Level 4 (550 points)

              I've already found a 6 on Amazon. But I would still like to get to the bottom of this error.

                • Re: Cannot test on iOS 11 device
                  KMT Level 9 Level 9 (15,425 points)

                  I suspect it's an out-of-sync pod vs. iOS version issue?

                    • Re: Cannot test on iOS 11 device
                      john daniel Level 4 Level 4 (550 points)

                      Can you elaborate? Are you talking about CocoaPods? I don't have any of that.

                      There is a slight possibility that I've missed resetting a deployment version. I can double-check that. But still the app runs fine. It's just the unit test target that fails.

                       

                      Currently, the "app" is just a single view with a quit button. It only exists in this form to run unit tests. What I'm trying to test is a monster open source framework (GDAL) that has taken me about 3 weeks just to get building on iOS. These unit tests are very important for me. For one, there is an awful lot of functionality to verify on an OS where this code has never run before. For another, some components are GPL and I'll be swapping them out with my own versions, but I want to use unit tests to compare my code against the "standard" GPL libraries.

                        • Re: Cannot test on iOS 11 device
                          KMT Level 9 Level 9 (15,425 points)

                               >CocoaPods?

                           

                          Right, as in the github ref. link above., but if you're not using them at all, then doesn't apply to your example.

                           

                          I think your (unit testing) issue is testing is all about the older OS (11?) on that one device (lower OS than the base SDK in the project), making that example an outlier for your purposes.

                           

                          Hopefully this is only due to iOS 11 and the iOS 12 test mule you have coming will act same as your iP11P, but if not, you may have to take what you can get and settle for not being able to unit test on older iOSs.

                           

                               >I'm concerned about any one-in-a-million failure as those scale up too.

                           

                          TestFlight may be in your future.

                           

                               > I'm not too familiar with iOS development either.

                           

                          Sounds like this project will cure that.

                           

                          Good luck.

                            • Re: Cannot test on iOS 11 device
                              john daniel Level 4 Level 4 (550 points)

                              Sorry about the link. That just happened to be the only place that I had seen someone else experience the same issue. The suggested fixes seemed plausible, but didn't work for either me or the CocoaPods user having the same problem. I guess there just isn't anyone testing against iOS 11 anymore. Assuming my iOS 12 device works out, I may just upgrade my other devices and be done with iOS 11 myself.

                               

                              I won't be at TestFlight stage for a long time. AWS Device Farm is a real possibility though.

                               

                              I filed a bug report (FB7488431). I also built a new project using only the basic template with the same error. That's as close to washing my hands of the situation as one can get.

                    • Re: Cannot test on iOS 11 device
                      eskimo Apple Staff Apple Staff (12,725 points)

                      If you start with a new app from the iOS > Game template, does it have the same problem?  I just tried that here, and it runs just fine on my iOS 11.4 victim device (I’m using Xcode 11.2 on macOS 10.14.6).

                      Note Normally I’d recommend the iOS > Single View App template, but the new template in Xcode 11 makes extensive use of UIScene, so it’s hard to get it running on iOS 11.  The iOS > Game template has a traditional app delegate, and thus backports to iOS 11 trivially.

                      I think the iPhone 6 was one of the few that is only upgradeable to iOS 12.

                      Correct.  Your iPhone 6s supports iOS 13, so there’s no supported way to get iOS 12 on it now.

                      Share and Enjoy

                      Quinn “The Eskimo!”
                      Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                      let myEmail = "eskimo" + "1" + "@apple.com"

                        • Re: Cannot test on iOS 11 device
                          john daniel Level 4 Level 4 (550 points)

                          I've already addressed the UIScene issue. The app runs on iOS 11. It appears to run fine, but it is just a placeholder for running unit tests at this point. It is those unit tests that don't work. On iOS 13, it runs fine and the unit tests work fine. But I still get that error message on iOS 13, even though the tests work. I don't know if the error message is even related to the failure to run tests. It seems to match the stack trace though.

                           

                          Currently, the "app" is just a single view with a quit button. It only exists in this form to run unit tests. What I'm trying to test is a monster open source framework (GDAL) that has taken me about 3 weeks just to get building on iOS. These unit tests are very important for me. For one, there is an awful lot of functionality to verify on an OS where this code has never run before. For another, some components are GPL and I'll be swapping them out with my own versions, but I want to use unit tests to compare my code against the "standard" GPL libraries.

                           

                          The framework is large (65 MB) but relatively simple in structure. I've gotten all of the components to link statically so that is not an issue. But given the scale of the iOS market, I'm concerned about any one-in-a-million failure as those scale up too. I'm not too familiar with iOS development either. I see many recommendations to delete derived data, clean, delete apps, reboot devices, etc.

                           

                          For example, I did have trouble with a resources directory named "Resources". I had forgotten about that. So is this failure just an after-effect of that earlier configuration problem because I'm using the same device that I had tried to use with a "Resources" resources directory? Is that why the other device works fine?

                          • Re: Cannot test on iOS 11 device
                            john daniel Level 4 Level 4 (550 points)

                            I was able to answer one question. I am a creature of habit and I do have another iOS 11 device. I get the same failure on this device too. Here is the backtrace:

                             

                            * thread #1, stop reason = signal SIGABRT

                              * frame #0: 0x000000010152e2f8 dyld`__abort_with_payload + 8

                                frame #1: 0x000000010152dad0 dyld`abort_with_payload_wrapper_internal + 100

                                frame #2: 0x000000010152dafc dyld`abort_with_payload + 12

                                frame #3: 0x0000000101504314 dyld`dyld::halt(char const*) + 312

                                frame #4: 0x00000001015073c4 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 6888

                                frame #5: 0x000000010150121c dyld`_dyld_start + 68


                            And error message: dyld: could not load inserted library '__PLATFORMS__/iPhoneOS.platform/Developer/usr/lib/libXCTestBundleInject.dylib' because image not found

                            I don't always get the error message, but it does always fail with the same backtrace.

                            It is not a critical issue. It just makes me a little nervous. I have an iPhone 6 on the way so I can test with iOS 12. I'm aware of rates of iOS adoption. It is just that I see random, unexplainable failures even on my Mac app. I don't want to just blame these issues on random failures or buggy Xcode. If it fails, I'm the one who has to deal with it.

                            • Re: Cannot test on iOS 11 device
                              john daniel Level 4 Level 4 (550 points)

                              Yes. A game template generates the same problem. It runs the app fine. It is the unit tests that fail to load.

                               

                              I filed a bug report (FB7488431). I guess it my own fault for not planning ahead and having an iOS 12 device handy. I guess I'll just drop iOS 11.