Error ITMS-90206 Invalid bundle contains disallowed file 'Frameworks' - ios

I have a problem uploading my application into the Store via Xcode, this one in particular.
I saw a lot of post about this error, but all are talking about Extension App, that I do not use.
I'm using a Custom framework and Cocoapods.
You can see here my tree :
XXX is my project app name
SharedXXX is my custom framework
Pods is the project created by cocoa pods
Here is my cocoa podFile :
use_frameworks!
link_with 'XXX', 'SharedXXX'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
workspace 'XXX'
xcodeproj 'XXX/XXX.xcodeproj'
xcodeproj 'Shared/SharedXXX.xcodeproj'
def default_pods
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
pod "SnapKit", '~> 0.17.0'
pod "DKChainableAnimationKit", '~> 1.6.0'
pod "AsyncSwift"
end
def shared_pods
pod "Alamofire", '~> 3.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'ReachabilitySwift', :git => 'https://github.com/ashleymills/Reachability.swift'
end
target :XXX do
xcodeproj 'XXX/XXX.xcodeproj'
default_pods
shared_pods
end
target :XXXDev do
xcodeproj 'XXX/XXX.xcodeproj'
default_pods
shared_pods
end
target :SharedXXX do
xcodeproj 'Shared/SharedXXXX.xcodeproj'
shared_pods
end
Build settings for custom framework (SharedXXX) :
I set the Embedded property to Yes
General Settings for custom framework (SharedXXX) :
The framework provided by Cocoapods is linked.
And to finish,
The General Settings to the main project (App Project : called XXX on the tree)
:
Any idea ?

I solved the problem
Firstly, set into Build Settings
For main project (here XXX) : Embedded Content Contains Swift Code to
YES
Custom Framework (SharedXXX) : Embedded Content Contains Swift Code to NO
Custom Framework (SharedXXX) : Runpath Search Path = #executable_path/../../Frameworks
This helped me solving that issue

I faced the same problem while trying to upload from Xcode 9.3
This happened because I added 'use_frameworks' in my OneSignal
NotificationServiceExtension
The value Always Embed Swift Standard Libraries found in Build Settings should be set to Yes only for you main Projects and not for your custom frameworks or extensions.

Related

Cocoapod can't identify my target after it was renamed

I had been using cocoapods to pod stuff but after I've renamed my whole xcode project, the cocoapod doesn't reconise my renamed target when I am trying to pod lottie, and I don't know how to replace the target with the new one
This error showed in terminal
[!] Unable to find a target named `Infinity Math`, did find `Infinity Math.temp_caseinsensitive_rename`, `Infinity Math.temp_caseinsensitive_renameTests`, and `Infinity Math.temp_caseinsensitive_renameUITests`.
My Pod file
platform :ios, '12.0'
target 'Infinity Math' do
use_frameworks!
pod 'UITextField+Shake', '~> 1.2'
pod 'SPAlert'
pod 'CBFlashyTabBarController'
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git'
pod 'lottie-ios'
target 'InfinityMathTests' do
inherit! :search_paths
end
target 'InfinityMathUITests' do
inherit! :search_paths
end
end
What should I do next in order to pod new pods?
Give the targets in the Podfile the same names that show up in Xcode:
target 'Infinity Math' do
target 'Infinity MathTests' do
target 'Infinity MathUITests' do
I've fixed it by renaming the target to the ones in the error
InfinityMath.temp_caseinsensitive_rename,
InfinityMath.temp_caseinsensitive_renameTests, InfinityMath.temp_caseinsensitive_renameUITests
It's weird

Please add the host targets for the embedded targets to the Podfile

My project is in Swift 2.0. I am try all possible ways but not found any solution.
My pod file
# Uncomment this line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, :deployment_target => '8.0'
# ignore all warnings from all pods
inhibit_all_warnings!
use_frameworks!
def available_pods
pod 'IQKeyboardManager'
pod 'Instabug'
pod "TSMessages"
pod 'AsyncSwift' , :git => 'https://github.com/duemunk/Async.git'
pod 'Onboard' # not used
pod 'DZNEmptyDataSet' # not used
pod 'iOS-Slide-Menu'
pod 'Kanna', :git => 'https://github.com/tid-kijyun/Kanna.git'
pod 'HanekeSwift', :git => 'https://github.com/Haneke/HanekeSwift.git'
pod 'Alamofire'
pod 'ObjectMapper', :git => 'https://github.com/Hearst-DD/ObjectMapper.git'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'ReachabilitySwift'
pod 'SCLAlertView'
pod 'ImageLoader'
pod 'NVActivityIndicatorView', :git => 'https://github.com/ninjaprox/NVActivityIndicatorView.git'
pod 'ActiveLabel'
pod 'MWFeedParser'
pod "SwiftElegantDropdownMenu"
pod 'SwiftHEXColors'
pod 'UITextView+Placeholder'
pod "AFDateHelper"
pod 'DateTools'
pod "SwiftDate", "~> 2.0"
pod 'APAddressBook/Swift'
pod 'FBSDKLoginKit'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'PusherSwift', git: 'https://github.com/pusher/pusher-websocket-swift.git', branch: 'push-notifications'
end
def available_pods_exc
pod 'Alamofire'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'ReachabilitySwift'
pod 'Kanna', :git => 'https://github.com/tid-kijyun/Kanna.git'
pod 'AsyncSwift' , :git => 'https://github.com/duemunk/Async.git'
end
target 'link' do
available_pods
end
target 'ReadLaterExtension' do
available_pods_exc
end
target 'Link Tests' do
pod 'Quick', '0.3.1'
pod 'Nimble'
end
I found below error
[!] Unable to find host target(s) for ReadLaterExtension. Please add the host targets for the embedded targets to the Podfile.
Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:
- Framework
- App Extension
- Watch OS 1 Extension
- Messages Extension (except when used with a Messages Application)
The problem is not in the podfile, but in the project!
To fix:
Go to XCode
Select your HOST target.
Open the target's 'General' page
In the 'Embedded Binaries' section, make sure your EXTENSION target is present.
In your Podfile you should have:
target 'HostApp' do
....
target 'YourExtension' do
....
end
end
In order to disable building/running the NSExtension you build, you should:
Click the project file in the project navigator
Click the containing app target (the one you DO want to run)
Click Build Phases tab
Open Target Dependencies
Remove the extension (the one you DON'T want to run)
To bring it back, simply click the + sign in the same place and
re-add it.
In my case working sucessfully
For future reference I would like to add one reason I just discovered for this error message:
In the Main Targets Build Phases the section Embed App Extensions has to be above the [CP] Copy Pods Resources and [CP] Embed Pods Frameworkds.

Can't find the right way to build my own framework target with my main app target

I decided to split my main project in two parts to reuse code, in a iOS widget.
So I created a new target file in my xcworkspace (cocoa touch framework).
Both targets have some pod dependencies in common and I can't figure the way right way to build.
First try:
In podfile, I've specified needed pods for both targets, but when building, I've multiple errors
Class Foo is implemented in both MyApp and MyFramework. One of the two will be used. Which one is undefined.
Second try:
Then I tried put framework target inside main app target (like we do usually with a test target)
target 'MyApp' do
main_pods
app_pods
target 'MyFramework' do
inherit! :search_paths
target 'MyFrameworkTests' do
inherit! :search_paths
testing_pods
end
end
end
But then the framework won't build as it didn't found dependencies
Example:
No such module Firebase
Note:
To build my main target, I've to build the framework target first, otherwise it's doesn't find 'MyFramework' module. No way to build both when I build the main target ?
I also have an app where I created a framework in a separate project but the same workspace. I use pods to get all external libraries, and embed my own framework in app's targets by adding it to Embedded Binaries in Xcode. My Podfile looks like this:
workspace 'MyApp'
abstract_target 'BasePods' do
use_frameworks!
pod 'Alamofire', '~> 4.4'
pod 'PromiseKit', '~> 4.1'
project '../MyAppProject/MyApp/MyApp.xcodeproj'
target 'MyApp'
target 'MyAppDevelopment'
end
target 'MyAppCore' do
use_frameworks!
pod 'Alamofire', '~> 4.4'
pod 'PromiseKit', '~> 4.1'
project '../MyAppProject/MyAppCore/MyAppCore.xcodeproj'
target 'MyAppCoreTests' do
inherit! :search_paths
end
end
What happens here I create two separate pod targets - one for the app, another one for the framework. I split them because they reside in different directories.
Got it, I had static libraries framework dependencies and the iOS linker does not support static library dependencies for dynamic libraries.
CF issue: https://github.com/CocoaPods/CocoaPods/issues/7126
I've solved it via Podfile by a workaround posted in the above issue:
post_install do |installer|
sharedLibrary = installer.aggregate_targets.find { |aggregate_target| aggregate_target.name == 'Pods-SampleFramework' }
installer.aggregate_targets.each do |aggregate_target|
if aggregate_target.name == 'Pods-SampleApp'
aggregate_target.xcconfigs.each do |config_name, config_file|
sharedLibraryPodTargets = sharedLibrary.pod_targets
aggregate_target.pod_targets.select { |pod_target| sharedLibraryPodTargets.include?(pod_target) }.each do |pod_target|
pod_target.specs.each do |spec|
frameworkPaths = unless spec.attributes_hash['ios'].nil? then spec.attributes_hash['ios']['vendored_frameworks'] else spec.attributes_hash['vendored_frameworks'] end || Set.new
frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename|
extension = File.extname filename
File.basename filename, extension
end
frameworkNames.each do |name|
puts "Removing #{name} from OTHER_LDFLAGS"
config_file.frameworks.delete(name)
end
end
end
xcconfig_path = aggregate_target.xcconfig_path(config_name)
config_file.save_as(xcconfig_path)
end
end
end
end

Xcode Workspace - Not finding imports from framework development pod

I've set up a workspace with two Swift projects in it: one a framework I'm developing, the other a demo app for the framework.
Podfile looks like this:
platform :ios, '9.0'
workspace 'foo.xcworkspace'
target 'framework' do
project 'framework.xcodeproj'
end
target :'demo' do
project 'demo/demo.xcodeproj'
pod 'framework', :path => 'framework.podspec'
end
the .podspec file looks like this:
Pod::Spec.new do |s|
s.name = 'framework'
s.authors = { "foo author" }
s.version = '0.1.0'
s.summary = 'foo summary.'
s.homepage = 'foo homepage'
s.platform = :ios, '9.0'
s.license = {
:type => "Proprietary",
:file => "LICENSE"
}
s.source = {
:git => 'https://url.to/foo.git',
:tag => s.version.to_s
}
s.source_files = 'framework/framework/**/*.{swift,h,m}'
s.requires_arc = true
s.weak_framework = "XCTest"
s.pod_target_xcconfig = {
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"',
}
end
After running pod install, Xcode/AppCode can still not see the classes from the framework project. So if I add a manual import to a class in the demo app and try to compile, it fails with:
Error:(13, 21) use of undeclared type 'FooClass'
What do I have to do to properly have the demo app project see the classes from the framework project generated pod?
Try using inherit! :search_paths on the demo target
This means they don't get their own copies of the pods but can see they exist via the header files.
platform :ios, '9.0'
workspace 'foo.xcworkspace'
target :framework do
project 'framework.xcodeproj'
end
target :demo do
inherit! :search_paths
project 'demo/demo.xcodeproj'
pod 'framework', :path => 'framework.podspec'
end
untested but perhaps worth a shot
If you install a Cocoapod don't use the file with .xcodeproj to open your project anymore, but the newly created .workspace in the same folder.
I finally resolved this issue:
Make sure the min. required iOS is defined in Podfile, e.g.:
platform :ios, '10.0'
Add any third-party pods also to the podspec file, e.g.:
spec.dependency 'Alamofire', '~> 4.5'
spec.dependency 'Serpent', '~> 1.0'
If doing pod install without the use_frameworks! it will mess up some things (see this answer: ld: framework not found Pods). So in between I got these invalid Pod xconfigs that I had to delete and then do a clean and pod install.
Make sure to build the framework project at least once and then the demo source should find the import to the framework pod name!
Make sure that all classes are correctly added to their target, especially classes in the test target should not have been added to the app target accidentally.
After all is said and done, having worked with a multitude of IDEs and development technologies, Xcode and Cocoapods can only be summed up as one giant clusterf*** of an accident!

Using dependency in swift module (framework)

I am trying to create a swift module (Cocoa Touch Framework) with reusable code inside the environment set up by cocoa pods which includes third party libraries written in Objective-C (namely here Restkit).
Unfortunately I am not able to use Restkit in the module I create.
Here's what I did to create the module:
File -> New target: Cocoa Touch Framework, Language: Swift, Project: MyProject, Embed in Application: MyProject
In the "Info" tab of the project settings in the "Configurations" section I define the Pods.debug and Pods.release xcconfig file for my newly created target.
In the header file, which Xcode automatically created for me, networkModule.h, I add the following line:
#import <RestKit/RestKit.h>
Result: When trying to compile I get the error "include of non-modular header inside framework module 'networkModule'"
I have set the flag for "Allow Non-modular Includes in Framework Modules" to YES in the build settings for the Project Target and the Module/Framework target.
I went to the Cocoa pod project and have tried setting the visibility of the RestKit.h Header file to "Public" in the target membership (which of course is not a good solution to mess with the cocoa pods environment)
I am not able to compile. I still get the same error.
Is it possible in the first place to create a Cocoa Touch Framework with dependencies to a cocoa pod managed framework?
Btw. My first idea of creating a private cocoa pod didn't work out as well, as it doesn't seem to be supported, although I am using the prerelease of cocoa pods 0.36 with support for swift.
You should be able to make your won private Pod. You just need to make a podspec for it. Here is an example of one.
Pod::Spec.new do |s|
s.name = "Commons"
s.version = "1.0.0"
s.summary = "Common code for my iOS projects."
s.license = {:type => 'Commercial', :text => "Copyright (c) Dan Leonard(Or Your Name?). All rights reserved." }
s.source = { :git => "https://github.com/PATHTOPOD", :tag =>
s.version.to_s }
s.homepage = "https://github.com/PATHTOPOD"
s.requires_arc = true
s.ios.deployment_target = '9.0'
s.subspec 'Core' do |ss|
ss.source_files = '*.swift'
end
s.subspec 'Menu' do |ss|
ss.source_files = 'Menu/*.swift'
ss.resources = ['Menu/*.storyboard', 'Menu/*.xcassets']
ss.dependency 'Alamofire'
end
end
Then Inside your project you just have to do pod init open your podfile that was just created and add this
source 'https://github.com/CocoaPods/Specs.git'
xcodeproj 'YOURPROJECT.xcodeproj'
platform :ios, '9.0'
use_frameworks!
pod 'Commons', git: 'https://github.com/PATHTOPODPROJECT'
#pod 'Commons', :path => '/Users/YourUser/Path/To/Project/commons'
pod 'KeychainSwift'
pod 'SQLite.swift', git: 'https://github.com/stephencelis/SQLite.swift.git'
Now in this example Podfile Commons is stated twice the second is commented out. If you uncomment it and comment out the first then do pod install in your projects folder from the terminal. This will make a DevelopmentPod which is a pod that is local. This way you can make changes to the pod locally within Xcode. No switching and pod installing every time you make a change.
You will import the pod just like any other by putting
import Commons not #import <Commons/Commons.h> That is how you do it in Objective C not Swift
Once you have a working version commit it to git hub and point your project to the the github version.
Hope this helps.

Resources