Ambiguous installation instructions for Realm iOS - ios

Steps 3 and 4 say:
In your unit test target’s “Build Settings”, add the parent path to
RealmSwift.framework in the “Framework Search Paths” section.
If using
Realm in an iOS, tvOS or watchOS project, create a new “Run Script
Phase” in your app’s target’s “Build Phases” and paste the following
snippet in the script text field:
bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework/strip-frameworks.sh"
This step is required to work around an App Store submission bug when
archiving universal binaries.
But it doesn't say where the unit test target's "Build Settings" or app's target's "Build Phases" are. Where are these things?

The Build Settings and Build Phases panes are panels in Xcode which have various settings and whatnot that you can customize to your needs.
To follow the instructions that Realm provided, you can navigate to "Test" however this will change to what your project is called.
And then Build Settings and Build phases are available around the middle of your screen at the top in Xcode. See the following screenshot:
From there you can open up Build Phases and click the plus (+) on the left hand side to create a "New Run Script Phase."
And from there, all what's left is filling in the information we supply in the documentation to create the run script phase.
I hope this helps. Cheers!

Related

Xcode - Bundle format unrecognized, invalid, or unsuitable

Ok so I have just about managed to get to this point on my own but am now having some issues code signing the app specifically with the AdMob framework. I am getting this error:
Command /usr/bin/codesign failed with exit code 1 the details it are giving are as follows: Applications/MyApp.app/Frameworks/GoogleMobileAds.framework: bundle format unrecognized, invalid, or unsuitable
I have read the other posts on the site and tried many different ways of fixing this. If I untick 'Code Sign On Copy' the archive builds successfully but then fails on validation with a match error. This is how I have my frameworks set up currently:
Any help would be much appreciated!
I saw this same issue with a different framework.
The solution for me was removing the framework from the 'Embedded Binaries' section and only adding it to the 'Linked Frameworks and Libraries' section in the target 'General' tab.
I have just seen the same issue but with a different framework that was the social framework and then I did below:
go to build phase -> embed frameworks -> press copy only when installing check box
then it worked with me with no error
I had a similar problem but with a different framework. The solution for me was to make sure that the framework was present in these three places:
General tab:
Embedded Binaries
Linked Frameworks and Libraries
Build Phases tab:
Embed Frameworks
I ran into this issue when using a different framework.
Clear the DerivedData solve this issue.
https://docs.sentiance.com/sdk/troubleshooting/ios/bundle-format-unrecognized-invalid-or-unsuitable
Go to Xcode menu bar and select File > Project Settings (or Workspace Settings).
Under Per-User Workspace Settings, find the shortcut to DerivedData folder and open it via Finder.
Remove the entire content of the folder and empty the Trash.
Restart Xcode.
In Xcode 11.*
Target -> General -> Linked Frameworks and Libraries
change related framework with option "Do Not Embed"
Else Check on the :
Target -> Build Phase -> Link Binary With Libraries
Check status with Required/Optional - try it with required first.

dyld: Symbol not found: __TMPdCSs12AnyGenerator

when I try to build and Run my project it gives me an error of symbol not found: __TMPdCSs12AnyGenerator
I had installed Xcode 7 beta on my system. When I installed it gives me an error of realm module not found so I just removed realm framework and added again after adding this frameworks again it gives about stated error.
I have encountered this problem after I update my XCode from 7.2 to 7.3. I use a framework build from XCode7.2. After I rebuild the framework on XCode7.3, the problem was solved.
You need to add Realm.framework and RealmSwift.framework to the “Embedded Binaries” section of your Xcode target.
You can check, if you have followed these steps correctly by following these steps:
Select your project in the Project Navigator.
Select your application target in the side bar in the section "Targets".
Navigate to the tab "Build Phases"
Expand the phase "Embed Frameworks"
The destination should equal "Frameworks". The list should contain Realm.framework and RealmSwift.framework.
If such phase doesn't exist, please create a Copy Files phase by clicking on the plus in the upper left corner and selecting "New Copy Files Phase". Select as destination "Frameworks" and add the Realm.framework and the ReamSwift.framework there.
I've added two exemplary screenshots below, so you can compare graphically how it should look like.
General Tab
Build Phases Tab
Application Bundle in the Built Products Directory
there's an update released for these frameworks to support Swift 2.2 (Xcode 7.3):
https://github.com/realm/realm-cocoa/releases/tag/v0.98.6

How to archive/export Framework in Xcode?

I have a project with a framework target, but when I archive, the framework does not show up in organizer. I checked apple for documentation, but only found reference for static libraries.
Has anyone experienced this before?
Here are screenshots of my current scheme settings
Go into your framework and build.
cmd+b
You will find in your products YOUR_FRAMEWORK.framework
Right click on "YourLibrary.framework" -> Show in Finder
Now you can share/import your library.
Attention: Don't link/reference to this path because the framework is stored in Derived Data.
The only thing you should do is build the target,then show Products in finder ,you will see it.
The steps are documented by Apple here
Set up the project
To set up your project for creating an XCFramework, ensure your Xcode project has a scheme that builds only the framework target and its dependencies.
Configure these build settings on your target:
Set the Build Libraries for Distribution build setting to Yes. For Swift, this enables support for library evolution and generation of a module interface file.
Set the Skip Install build setting to No. If enabled, the built products aren‘t included in the archives.
Leave the Architectures build setting unset. The predefined value configures the target to build a universal binary for all the possible architectures the target platform uses.
Then you can use Archive to build your framework for Release.
Once built, the Organizer window will open.
You can then click on Distribute Content -> Build Products and export your framework.
Archive framework
Product -> Archive
//or
xcodebuild archive
[Archive location]
Xcode v12 does not have such problem and when you try to archive a framework Xcode prompt you to corresponding Archives window
Archive is an action from Scheme[About] which is competitor for Build action. Archive includes Build with additional logic. For example Archive is used for XCFramework[Example] which additionally can contains .dSYM and .BCSymbolMap files
For usual purposes you can just use Build action, it creates a corresponding .framework file in a Build location[About]

How to add .plist file to all targets in Xcode?

Totally new to iOS but I'm currently trying to setup Google Analytics. I have followed the SDK documentation and everything went great until this step:
Add the configuration file to your project
Drag the GoogleService-Info.plist file you just downloaded into the root of your Xcode project and add it to all targets.
It doesn't say anything on HOW to add it to all targets. Being new to Xcode and iOS in general, I'm completely lost. Anyone with an answer for me?
Thanks!
Select the GoogleService-Info.plist in the project navigator (the file hierarchy on the left side of Xcode). Then, if it isn't open yet, open the utilities bar (click the top-right most button in Xcode). You will see a section 'Target Membership'. Check all the checkboxes to add the .plist to all targets.
In most cases it is enough to just add the file to your project.
Physically drag the GoogleService-Info.plist file from your download folder ( or wherever you saved it) to your main project directory as shown below. Once you do that, the "Targets" dialog should open automatically and you can choose all targets (...click on all the targets shown)
In Xcode 6
Follow the step sequence in this digram.
First select your target.
Select build settings tab.
Search for "info.plist file"
Edit the value for key "info.plist file" (Add the actual plist path in step 4)
If you select the plist in question and then go to the file inspector (press command+option+1 or select the first tab on the right panel), you can select on which targets you wish to include it:
Update for Xcode 12.3:
It should be selected automatically, but check anyway:
ce you drag the file to the root dir, select it and on the very right hand side you will see Target membership, make sure all the targets are selected.
It is important to note that GoogleService-Info.plist file should be added to xCode i.e. open your xCode and drag the file to Runner > Runner.
Then click on GoogleService-Info.plist. On the right side of he screen you can find Target Membership.

Xcode can build a project but can't run it on simulator

When I download a project from the web, sometimes it can be built but doesn't run (XCode -> Product -> Run is disabled, in grey). This never happens when I create projects myself. What could be the problem? Is it somehow connected with version?
I'm new to iOS development and download projects from the web for studying purposes. It's a pity not to be able to test them on the simulator.
Generally, if you can't Run a project, either:
It doesn't have a build scheme that knows how to "run". Check at the top next to the Run/Stop buttons that there's a profile name and target device shown. If the box says No Scheme then click on it and create a New Scheme. If there IS a scheme, click on the drop-down menu (left divider in Xcode 4.2+, anywhere on the box otherwise) and go to Edit Scheme to make sure the scheme was set up correctly for Running
It doesn't have a build configuration set. You should see this in the Run section of your build scheme. Check there's one selected. If the list is empty, go to the Project icon at the top of the leftmost pane, select the Project, go into the Info section, and create a build configuration, although there should already be at least one if you can build the project
It doesn't have a runnable target at all, which might mean you've got a project which compiles to a static library or framework for use in OTHER projects. If this is the case, you should see the icon for your build Target as a yellow toolbox (framework), or a little white building (a "library", although to me it looks more like the United States Supreme Court Building).
The target isn't valid for the Simulator, which means you might need to add i386 to the list of Architectures and Valid Architectures on the Target before you can run it
The target isn't valid for the currently connected device. For this one, check the Deployment Target number is set back enough to be valid for the device's version of iOS
Xcode can't see the connected device. Try unplugging and plugging it back in. If it still doesn't recognize it, you may have not added it to Xcode (Window -> Devices -> Select the device -> Use for Development)
Make sure that in your Edit Scheme (click on your project name next to stop button -> Edit Scheme), in the Info tab of the Run menu selection, that your .app is selected as the Executable. I had this issue and "None" was selected, happened after refactoring the project's name and reconfiguring the build targets.
you may download a project that the deployment setting (the ios version) is higher than the one your xcode support. if this is your situation, you has two options to sovle the problem.
try run the project in a older deployment option. follow these instructions (
if the project just setting to a higher version but not using any feature of the higher version. this approach should work):
select project file in xcode > select the target you are going to run > select summary tab > in section 'iOS Application Target' > in the combo box about 'Deployment Target' select the version that your Xcode support.
and then you could select and run the project in the simulator.
if the project dose use features in the higher version, then you should update your Xcode in order to run the project.
Hope this helps!
In my case the issue was really simple, I needed to check "Launch: Automatically" check in "Product > Scheme > Edit scheme > Run" menu.
When this setting wasn't checked I cannot find App icon in simulator to launch application.
In My Case Sole by Go->Project->Architectures->Architecture=select standard architectures(armv7,arm64)...
same as
Go->Target->Architectures->Architecture=select standard architectures(armv7,arm64)...

Resources