Remove edit button on ThumbnailViewController PDFTron - ios

I have a requirement wherein I do not need the Edit/ Delete button that appears in ThumbnailViewController for PDFTron Library iOS. I have seen that the control for this is available in ThumbnailsViewController.m. But I am using dynamic framework and therefore I do not have access to this file. How can I remove this feature?
Now I am able to generate the updated Tools framework but when I replace it in the project, I am encountering the following error:
dyld: Library not loaded: #rpath/Tools.framework/Tools
Referenced from: /Users/sus/Library/Developer/CoreSimulator/Devices/0B6B340D-AE6A-4B91-B8C4-294FDC50D204/data/Containers/Bundle/Application/D568E9C5-1D13-475B-BB3A-C892AE0D29FA/Complete Reader.app/Complete Reader
Reason: no suitable image found. Did find:
/Users/sus/Library/Developer/CoreSimulator/Devices/0B6B340D-AE6A-4B91-B8C4-294FDC50D204/data/Containers/Bundle/Application/D568E9C5-1D13-475B-BB3A-C892AE0D29FA/Complete Reader.app/Frameworks/Tools.framework/Tools: no matching architecture in universal wrapper
This is happening both on the sample as well as my app.This happens when I try to build for Generic iOS device. It works fine when I build for any simulator.

To remove these options you need to modify the ThumbnailViewController.m file.
But I am using dynamic framework and therefore I do not have access to
this file.
That should not be an issue. You should be able to modify and build the Tools framework in XCode. If you are still stuck, please update your question on what you mean exactly by "I do not have access to this file."

Related

Xcode automatically renames libraries inside the library

I have an issue and I guess somebody can help me to resolve it.
So, I created my own framework from my code and I added dependent frameworks in it. That's OK.
There is the struct of it:
After that I've implemented my own framework into my app. I can launch app without any issues on my real device. There are no any issues with it. My framework works as expected.
I need publish my app with implementation of my own framework. And I see that for some reason the frameworks inside my framework have the same name:
Although it should be 7 frameworks with names as in the structure. As result I see the error from Apple:
The question is: why did my internal frameworks get the same name when trying to publish and how to fix it?
Please check under your "Build Settings" option, there is "Build Options", check if below setting is switched to "Yes".

Library not loaded issue in Xcode

I've done some search for answer of Library not loaded and I found almost every answer related to using framework in Application but my problem is different. Its actually using framework in framework and then use in App.
Lets say I have framework A and B, framework A use framework B and then framework Library not loaded use in App so eventually I only want to use or expose frame A in app rather than both and there is no directly need of Framework Library not loaded in App.
What I've done so far:
Added Framework A into App and added also into Embedded Binaries and use some code of Framework A but no Framework B. Build and Run
Issue
Build succeeded but right after installing app into device this generate issue.
dyld: Library not loaded: #rpath/B.framework/B
Referenced from:
/private/var/containers/Bundle/Application/6A869182-AFE5-403-2809B4AAA843/A-SDK-DemoApp.app/Frameworks/A.framework/A
Reason: image not found
note: Frameworks name changed according to A and B.
Requirement
I only want to share framework A with client instead of framework B, because App will communicate with framework A only, so need some suggestion how to resolve this, also please don't refer me those answer that relate to single frame add into app. Thanks
After spending some time and read this answer, which clearly says
I contacted Apple with this issue and found a solution to my problem.
Apple's Technical support made it clear, that I need to add the
FrameworkB.xcodeproj to my application project
So I just used some trick, in Framework A go to Target -> Add New Copy File Phase -> Changed destination to Framework -> add Framework B as shown in screen shot.
Now build Framework A, go to Product folder and click on show in finder Framework A, you will see Framework B will be added and expose inside A as show in screenshot.
This all from framework side, Now add framework A in Embedded section inside App. Now again try to add another framework in Embedded section and click Add Others button, click on Framework A -> click on Framework folder choose Framework B as shown in screenshot.
This will resolve issue.If someone not understand feel free to comment I'll try to make it clear. Hope this will help others too.

dyld: Library not loaded: #rpath/libswiftSwiftOnoneSupport.dylib

I've built a Swift framework and now I'm trying to start building a Swift iOS application that will use that framework. I'm getting this error:
dyld: Library not loaded: #rpath/libswiftSwiftOnoneSupport.dylib
Referenced from: /Users/tdean/Library/Developer/Xcode/DerivedData/NFLApplication-ejmafvjrlqgjaabggwvadjarjjlg/Build/Products/Debug-iphonesimulator/NFLStatsModel.framework/NFLStatsModel
Reason: image not found
I've scoured SO and found similar reports and tried the fixes listed there, including:
Clearing out my DerivedData folder
Restarting Xcode and the iPhone simulator
Ensuring that Always Embed Swift Standard Libraries = YES is set, both in my framework and my application's build settings
Ensuring that Enable Bitcode=NO is set, both in my framework and my application's build settings
Ensuring that Runpath Search Paths is set to #executable_path/Frameworks, both in my framework and my application's build settings
Copied all the libswift files from my Xcode installation into a local copy within my project, and added a custom build phase to copy those files into the frameworks folder.
In every case, I get the same error when I try to run my application.
Xcode Version 8.1 (8B62)
Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)
I eventually got this working using a mix of fixes. I'm not sure if all of them are needed, but I'm documenting what seemed to work for me here, just in case anyone else can benefit by what I've found.
I have set Always Embed Swift Standard Libraries to a value of YES in the build settings tab for both my Swift framework and in the Swift application that uses the framework.
I have added Foundation.framework to the Linked Frameworks and Libraries section of the general tab for both my Swift framework and in the Swift application that uses the framework.
I have added Foundation.framework to the Embedded Binaries section of the general tab for the Swift application that uses the framework.
With all 3 of these settings in place, I am able to build and run my application without encountering this error.
This might not be the case for everyone, but I solved it by actually writing some code in the main target.
I had an empty project consisting of a framework and a test target, and when running tests I was getting this error. Apparently Swift is pretty smart to detect that you don't actually need this library and does not link to libswiftSwiftOnoneSupport.dylib.
The fix is just to add some code, I just added:
class Test {
func a() { print ("something") }
}
and libswiftSwiftOnoneSupport.dylib got linked.
After several days of being stuck with this issue I finally found something that worked for me; hopefully this will help others too.
Turns out that specifically using print() anywhere in the code will somehow force libswiftSwiftOnoneSupport.dylib to be loaded and the issue will go away.
I'm using Xcode 10.1, Swift 4.2 and the pod that was giving me this issue was Nimble.
BTW, I am aware of #S2dent's suggestion to "just add some code" but in my case my framework already had several different classes so it didn't help me.
How are you installing your dependencies?
I had a similar issue:
dyld: Library not loaded: #rpath/libswiftSwiftOnoneSupport.dylib
Referenced from: <internal framework>
Reason: image not found
It turned out to be related to Swift whole-module optimization.
Using Carthage as a dependency manager, they were being compiled for Release, and thus compiled with whole-module optimization, which Xcode suggested I turn on. Running the app on the simulator compiles it for Debug. I'm guessing that dynamic frameworks cannot be at a different level of optimization from the app running it.
The solution was to explicitly specify the configuration I wanted Carthage to build for. (carthage bootstrap --configuration Debug) Oh, and cleaning my build folder, of course.
I had the same issue, adding the library (my own build one) to Linked Frameworks and Libraries in General tab of the app solved the issue.
You can also provide an Host Application to your test target if you don't want to add Foundation.framework to Linked Frameworks or Embedded Binaries
You can solve this by setting "Always Embed Swift Standard Libraries" to "Yes" in the Build Settings of your target.
It is an dynamic linker error which links binary in load or runtime
[#rpath]

Framework folder getting generated inside dynamic framework

I am creating a dynamic framework using Swift. When I build the framework, the resulting artifact has a Framework folder that has a bunch of system dylibs that I don't expect.
I am using this documentation for reference - https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html#//apple_ref/doc/uid/20002253-99920-BAJFEJFI
Because of this folder and libswiftRemoteMirror.dylib, the app's release archive is getting rejected by iTunes upload.
I found out the solution to this. In my framework build settings, I had Always Embed Swift Standard Libraries enabled which should have been disabled. Not sure why it was enabled in the first place, since I didn't write the framework, someone else did. But I think it might have been because they started the project using an iOS app template instead of the framework template.

Using pre compiled dylib in iOS8+ or building dynamic framework out of dylibs?

I'm trying to use a fat dylib I've made that contains the latest version of tbb with code for all architectures I may be targetting (armv7, arm64, i386 and x86_x64)
Since iOS8 using dylib(s) is meant to be possible, in fact one of the error messages I found googling was the following one:
ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later
Which seems to suggest that embedding dylibs is actually possible and we aren't only restricted to the new so called dynamic frameworks, yet, when I try to run my project I get the following:
dyld: Library not loaded: #rpath/libtbb.dylib
Referenced from: /Users/user/Library/Developer/CoreSimulator/Devices/B4DCFF3E-10B2-4C01-953F-BD26D14300E7/data/Containers/Bundle/Application/8C84A844-97FC-4993-A37E-A456C4E2240F/TestTBB.app/TestTBB
Reason: image not found
I thought it would be due to the dylib not being automagically copied into the app being built so I added it to the "Copy Bundle Resources" section in the projects "Build Phases" and I've since made sure that the libtbb.dylib is in fact being copied into the app and yet I keep getting the message saying that it can't be loaded.
I've tried using the "Embedded Binaries" section under "General" but it seems to be restricted to using only the new framework types.
Is there anything I might be missing?
As you may have noticed I'm trying to use TBB which comes with its own build makefiles that generates dylibs, I'm assuming that if it does it's because dylibs can be used, legally since the iOS8+ update.
I have seen ways of getting dylibs to load, but these aren't the ones that Apple would accept in their AppStore, I'm trying to do this for an app that is currently on the AppStore and I have no plans of getting it removed or not accepted after an update so I'd like to go with whatever the new "legal" way is to get dylibs loaded. My app is targetting iOS9.2+ since the latest update so this shouldn't be an issue.
All I can find are ways to get dynamic frameworks loaded but no info about actual dylibs even though the error message clearly states that they could be used.
Alternatively, is there a way to build a dynamic framework out of existing dylib files?
Thanks in advance.

Resources