Is There A Way to Apple App Store Verify Frameworks?
MY DILEMMA:
I tend to write in a very modular fashion, creating frameworks and SDKs to be used by contractors and third parties.
I write in systems, not apps, so this model is important.
A few years ago, I wrote an Objective-C static library that used BSD sockets to communicate with devices over a specialized WiFi setup. It used HTTP, but had some quirks that required the low-level stuff, and the devices didn't use HTTPS.
Back then, that was OK. I doubt that an app that uses that library would pass App Store review, nowadays.
I'm in the midst of writing another framework now. I doubt it will have the same issues, as everything is being done using high-level stuff, but I'd still like to be able to verify that when I send my app out into the world (probably as a CocoaPod), I won't be giving anyone a dependency that could cause their app to fail validation.
Is there a way to do an App Store Verify on components? Is there a test tool that I haven't seen that could scan for things that could fail validation?
WHAT I HAVE CONSIDERED
The natural first thought is to create a test harness, and submit that for validation, but never release it.
There's another problem: You can't delete unreleased apps from the App Store. I have a bug report in about it, but I suspect that it is not a priori with Apple. It's still lying fallow after a couple of years.
I have quite a few apps, and several of them are zombies. It's annoying.
So I am loathe to submit a test harness, and end up with yet another zombie.
I know that the Apple dev system is loaded with all kinds of CLI utils that aren't documented. I can't find any with my searching, but I may be using the wrong search terms.
Anyone have any ideas about this?
1 answer
-
answered 2018-09-23 12:37
Ashley Mills
Rather than create another "zombie" app, you could replace one of the existing ones with your test harness app. As long as you keep the same bundle id, you can change anything else (name, etc).
See also questions close to this topic
-
Changing the size of a modal view controller
Once, the user taps a button, I want my modalViewController to appear as a small square in the middle of the screen (where you can still see the original view controller in the background).
Almost every answer on stackoverflow I find uses the storyboard to create a modal view controller, but I've gotten this far with everything I've found.
When you tap the button that is supposed to bring up the modal view, this function is called:
func didTapButton() { let modalViewController = ModalViewController() modalViewController.definesPresentationContext = true modalViewController.modalPresentationStyle = .overCurrentContext navigationController?.present(modalViewController, animated: true, completion: nil) }
And the modalViewController contains:
import UIKit class ModalViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .blue view.isOpaque = false self.preferredContentSize = CGSize(width: 100, height: 100) } }
Based on the answers I found, I was under the impression that if I set
preferredContentSize = CGSize(width: 100, height: 100)
, then it would make the modal view controller 100px x 100px.However, the view controller takes up the entire screen (except for the tab bar because I set
modalViewController.modalPresentationStyle = .overCurrentContext
I'm obviously missing a step here, but I want to do everything programmatically as I'm not using the Storyboard at all in my project (except for setting the opening controller)
Thanks in advance for you help!!
-
Stretchy Layout not working with child view controller
I'm trying to follow the example described here for making a stretchy layout which includes a
UIImageView
andUIScrollView
. https://github.com/TwoLivesLeft/StretchyLayout/tree/Step-6The only difference is that I replace the
UILabel
used in the example with the view of a childUIViewController
which itself contains aUICollectionView
. This is how my layout looks - the blue items are theUICollectionViewCell
.This is my code:
import UIKit import SnapKit class HomeController: UIViewController, UIScrollViewDelegate { private let scrollView = UIScrollView() private let imageView = UIImageView() private let contentContainer = UIView() private let collectionViewController = CollectionViewController() override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } override func viewDidLoad() { super.viewDidLoad() scrollView.contentInsetAdjustmentBehavior = .never scrollView.delegate = self imageView.image = UIImage(named: "burger") imageView.contentMode = .scaleAspectFill imageView.clipsToBounds = true let imageContainer = UIView() imageContainer.backgroundColor = .darkGray contentContainer.backgroundColor = .clear let textBacking = UIView() textBacking.backgroundColor = #colorLiteral(red: 0.7450980544, green: 0.1235740449, blue: 0.2699040081, alpha: 1) view.addSubview(scrollView) scrollView.addSubview(imageContainer) scrollView.addSubview(textBacking) scrollView.addSubview(contentContainer) scrollView.addSubview(imageView) self.addChild(collectionViewController) contentContainer.addSubview(collectionViewController.view) collectionViewController.didMove(toParent: self) scrollView.snp.makeConstraints { make in make.edges.equalTo(view) } imageContainer.snp.makeConstraints { make in make.top.equalTo(scrollView) make.left.right.equalTo(view) make.height.equalTo(imageContainer.snp.width).multipliedBy(0.7) } imageView.snp.makeConstraints { make in make.left.right.equalTo(imageContainer) //** Note the priorities make.top.equalTo(view).priority(.high) //** We add a height constraint too make.height.greaterThanOrEqualTo(imageContainer.snp.height).priority(.required) //** And keep the bottom constraint make.bottom.equalTo(imageContainer.snp.bottom) } contentContainer.snp.makeConstraints { make in make.top.equalTo(imageContainer.snp.bottom) make.left.right.equalTo(view) make.bottom.equalTo(scrollView) } textBacking.snp.makeConstraints { make in make.left.right.equalTo(view) make.top.equalTo(contentContainer) make.bottom.equalTo(view) } collectionViewController.view.snp.makeConstraints { make in make.left.right.equalTo(view) make.top.equalTo(contentContainer) make.bottom.equalTo(view) } } override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() scrollView.scrollIndicatorInsets = view.safeAreaInsets scrollView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: view.safeAreaInsets.bottom, right: 0) } //MARK: - Scroll View Delegate private var previousStatusBarHidden = false func scrollViewDidScroll(_ scrollView: UIScrollView) { if previousStatusBarHidden != shouldHideStatusBar { UIView.animate(withDuration: 0.2, animations: { self.setNeedsStatusBarAppearanceUpdate() }) previousStatusBarHidden = shouldHideStatusBar } } //MARK: - Status Bar Appearance override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { return .slide } override var prefersStatusBarHidden: Bool { return shouldHideStatusBar } private var shouldHideStatusBar: Bool { let frame = contentContainer.convert(contentContainer.bounds, to: nil) return frame.minY < view.safeAreaInsets.top } }
Everything is the same as in this file: https://github.com/TwoLivesLeft/StretchyLayout/blob/Step-6/StretchyLayouts/StretchyViewController.swift with the exception of the
innerText
being replaced by myCollectionViewController
.As you can see, the
UICollectionView
is displayed properly - however I am unable to scroll up or down anymore. I'm not sure where my mistake is. -
Swift combine different type into one array to display data for UITableView
I have tableview where I need to show few sections. You should imagine this table like a playlist of your songs. In the top first section I need to display a cell with button which will add more songs to the playlist and other sections of tableview are header titles of Music category (like pop, rock and etc). Each of these sections contains cells which are songs names.
I have an array of songs called like this:
var songsGroups = [SongGroup]
. Which is actually my datasource.SongGroup
contains few properties:var categoryName: String var songs: [Songs]
But the problem appears on the next level. I every time need to check indexPath.section and do like this:
if indexPath.section == 0 { // this is a section for ADD NEW SONG BUTTON cell no need in header title as there is no data repression only static text on the cell. } else { var musicCategoryName = songsGroups[indexPath.seciton - 1]. categoryName headerTitle.title = musicCategoryName }
As you see my code became magical by adding this cool
-1
magical number. Which I replay don't love at all.As an idea for sure I can try to combine my ADD NEW SONG BUTTON section (by adding some additional object) with
songsGroups
array and create NSArray for this purposes. Like in Objective-C as you remember. So then my datasource array will looks like this:some NSArray = ["empty data for first cell", songsGroups[0], songsGroups[1]... etc]
So then there is no need to check any sections we can trust our array to build everything and even if I will add more empty data cells there is no need for me to handle my code via if block and adding tons of magical numbers.
But the issue I see here that we don't use explicit types of array and it's upset.
So maybe you know more beautiful solutions how to resolve my issue.
-
Value not passing between viewControllers
Struggling to get my viewControllers to send value from the main viewController to a second. I want it to happen on a button click, I'm going to get the value from the button and pass it to the new form. But it just isn't working.
Code for main ViewController
class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } @IBAction func butClick(_ sender: UIButton) { NSLog("Button Pressed : %@",[sender .currentTitle]) //var tt = [sender .currentTitle] // Create the view controller let vc = TimesTablesViewController(nibName: "TimesTablesViewController", bundle: nil) vc.passedValue = "xx" self.performSegue(withIdentifier: "pushSegue", sender: nil) } }
Code for second viewController called TimesTablesViewController:
class TimesTablesViewController: UIViewController { @IBOutlet weak var titleLabel: UILabel! var passedValue:String = "" override func viewDidLoad() { super.viewDidLoad() titleLabel?.text = "\(passedValue) Times Table" } }
I've followed tutorials but can't seem to solve the problem! Thanks for any help!
-
Observable.create inside generic Alamofire call function not working when calling validate()
I want to make a validated network request using Alamofire, through a 'generic' function. If I don't use RX at all or if I don't call validate() or anyCustomValidate() it works fine, but if I use it with the Observable.create and validate() as below, it does not work. This is what it does instead:
1.makes tokenRefresh call 2.receives the new token 3.calls completion(true, 0.0) (as below)
but then nothing happens...
Here is my generic function:
func sendRequest<Response: Codable>(endpoint: URLRequestConvertible) -> Observable<Response> { return Observable<Response>.create { observer in let request = self.session.request(endpoint) .validate() .responseJSON { response in print(response) switch response.result { case .success: do { let model = try JSONDecoder().decode(Response.self, from: response.data!) observer.onNext(model) } catch { print("generic call function error: \(error)") observer.onError(RequestError.failedParsingError(ErrTypes.somethingWrong.rawValue)) } case .failure: observer.onError(RequestError.failedParsingError(ErrTypes.somethingWrong.rawValue)) } } return Disposables.create { request.cancel() } }.observeOn(MainScheduler.instance) }
This is how I use it to get a specific response:
func getAddresses(clientId: Int) -> Observable<[AddressesResponse]> { return sendRequest(endpoint: CustomerEndPoint.getAddresses(userID: clientId)) }
And this is how I call the function:
@objc func buttonPressed() { getAddresses(clientId: 1111).subscribe(onNext: { addresses in print(addresses) }).disposed(by: disposeBag) }
This is my Request retrier:
extension AuthHandler: RequestRetrier { func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion) { guard let request = request as? DataRequest, request.delegate.data != nil else { fatalError() } guard let headerStatusCode = request.response?.statusCode else { completion(false, 0.0) return } if headerStatusCode == 401 || headerStatusCode == 403 { refreshToken(success: { completion(true, 0.0) }, failure: { message in print(message) }) } else { if let json = String(data: request.delegate.data!, encoding: String.Encoding.utf8), let jsonObject = dictionaryWithJSONString(json) as? [String:Any], let statusMessage = jsonObject["statusMessage"] as? [String: Any], let status = statusMessage["status"] as? Int { if status == 401 || status == 403 { self.refreshToken(success: { completion(true, 0.0) }, failure: { message in completion(false, 0.0) print(message) }) } } } }
After a while this gets printed on the console log:
2019-02-17 22:25:13.368846+0100 AlamofireValidator[76262:1527976] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x7fc5cf50e020] get output frames failed, state 8196
-
Passing class by value
I'm new to Swift so please let me know if I've missed something painful obvious. I have a
class
that I want to pass by value to overload the+
operator.The code won't work if I define the left argument
lhs
asfoo
but then it is immutable, and will work iflhs
isinout foo
, but then I have modifiedlhs
which I clearly do not want.A quick breakdown of my class:
class foo<T: Numeric> { /* Data */ /* Init Fn */ /* += definition */ static func + (lhs: foo, rhs: foo) -> foo { do { try lhs += rhs return lhs } catch { /* Error Handling */ } } }
I come from a C++ background, so I am surprised that I am unable to pass the object by value if I choose. Following the question What are the basic rules and idioms for operator overloading?, in C++ this overloading method would expect the left argument to be passed by value and the right argument to be passed by
const &
as shown below, but here I don't seem to have that option.class X { /* In Swift operators are not defined internally like this */ X& operator+=(const X& rhs) { // actual addition of rhs to *this return *this; } }; inline X operator+(X lhs, const X& rhs) { lhs += rhs; return lhs; }
Is there a way that I don't know about, or is overloading done differently in Swift?
Any help would be greatly appreciated.
-
How to add UILabel to UICollectionView Controller
I created a collectionView Controller in storyboards. Everything works fine , but now i need to create UILabel in CenterX/CenterY position.
@IBOutlet var routesCollectionView: UICollectionView! messageTextLabel.isHidden = false messageTextLabel.centerXAnchor.constraint(equalTo: self. routesCollectionView.centerXAnchor).isActive = true messageTextLabel.centerYAnchor.constraint(equalTo: self. routesCollectionView.centerYAnchor).isActive = true self.routesCollectionView.addSubview(messageTextLabel)
This code gives me an error. I understand that theres no view in collection view controller. Any idea how i can add this UILabel?
-
Is there a way to hide letters that are right next to the classes names in Xcode?
I tried to ignore them but it's too annoying for me and right now I just want to get rid of them.
-
Node JS header problems with ionic
So i am using ionic framwork to make my app and using nodeJS as my backend but i am still a noob in this and i can't seem to figure it out still after 4 days so hopefully someone could answer this problem to me and why would be appreciated.
So for my ionic client side i do this to make a http.post request
progress() { var headers = new HttpHeaders(); headers.append('Accept', 'application/json'); headers.append('Content-Type', 'application/json'); let options = {headers: headers}; let postData = { username: this.username, email: this.email, password1: this.password1, password2: this.password2 }; this.http.post('localhost:4000/api/users', postData, options,).subscribe( data => { console.log(data); }, error => { console.log(error); }); }
and this is what i am doing to get the data from the server but that's not working
// Packages let express = require('express'); var request = require('request'); var bodyParser = require('body-parser'); var cors = require('cors'); const app = express(); app.use(cors({origin: 'http://localhost:8100'})); const port = 4000; app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); // Whenever you enter localhost:4000/ // app.get('/', function (req, res) { res.send(('Server runs')); }); app.listen(port, () => console.log(`app listening on port ${port}!`)); app.get('/api/users', (req, res) => { res.send('api/users page'); request.get({ uri: 'http://localhost:8100/create-account' }, function (err, res, body) { console.log('error:', err); // Print the error if one occurred and handle it console.log('statusCode:', res && res.statusCode); // Print the response status code if a response was received res.send(body); }); });
i also tried 'http://localhost:8100' & 'localhost:8100' so someone help me
-
How can I fetch specific row data from excel dynamically by passing method name in Selenium/TestNG
I want to fetch data from excel using one column as Method name. First column of my excel contains method names in each row. and from the next columns is data
I saw multiple post using testNG data provider annotation but they are not helping in what I need
-
My Cocoa framework functions are not visible when I import it. How to add functions to header?
I have created a Cocoa framework project using Swift. It generated a Objective-C header file
Logger.h
. I have created methods as public and build succeeds. When I link and import the framework in another project, only the variables declared in the header are available.#import <Cocoa/Cocoa.h> //! Project version number for Logger. FOUNDATION_EXPORT double LoggerVersionNumber; //! Project version string for Logger. FOUNDATION_EXPORT const unsigned char LoggerVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <Logger/PublicHeader.h>
How do I add the functions I created in
Logger.swift
to the header so that they are visible after module import. The imported project is also using Swift 4.2.Example functions in
Logger.swift
public struct Logger { public func debug(_ msg: Any) { // ... } // ... }
I also tried creating static library as per the Creation of pure Swift module article, but when I am getting a linker error unable to find the module. I have included the lib path and
-lLogger
flag, also tried adding through Xcode's Add binary option. -
How to convert purchased iOS app to .ipa on windows, and install it later?
How can I convert any App Store purchased application, say PUBG Mobile to .ipa file as a backup on windows, and then reinstall it again when needed?
-
Which payment gateway to use in iOS?
my app has a "credit" system which associates each user with a certain amount of credit (which can be obtained through purchasing it). The app also ranks users on a leaderboard with this credit but with the amount of credit, users are eligible for physical content when certain credit is established. In this case what kind of payment process is appropriate?
I currently have stripe payment integrated but I'm afraid it would get rejected.
-
How to keep two versions of an React Native app installed (production and demonstration apps)?
I am in need of advice of how to deal with something:
I have an app that will soon be published to App Store and Google Play and I would like to find a way to have a clone of this app with the purpose to give a taste of the app for users and also for the salesman of the company to demonstrate to possible users but also I would like to keep both apps installed, so in the case of the salesman he would be able to demonstrate and also use the real app.
I know that I could just have a beta user group on TestFlight and Google Play but that would need me to register those users or also give them a link and would not be possible to have both apps installed.
I would just like to make this "demonstration app" to be downloadable from the stores, it would have different API calls from the Real app, but I would like to avoid having to maintain and copying every change from the "production" app to the "demo" app.
The option I thought: create a branch and rename the app to the new signature, name, icons and so I will just have to always pull the diff from the origin/master branch and publish it on the stores.
I would appreciate to receive ideas and workarounds for this.